Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][locker] Simplify save page layout

aman-pilot9fb880fef069
diff --git a/mobile/apps/locker/lib/ui/pages/save_page.dart b/mobile/apps/locker/lib/ui/pages/save_page.dart
index 0c4f1d435e..51574f7448 100644
--- a/mobile/apps/locker/lib/ui/pages/save_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/save_page.dart
@@ -1,6 +1,6 @@
import 'dart:async';
-import "package:ente_ui/components/close_icon_button.dart";
+import "package:ente_components/ente_components.dart";
import "package:ente_ui/theme/colors.dart";
import 'package:ente_ui/theme/ente_theme.dart';
import "package:ente_ui/theme/text_style.dart";
@@ -19,23 +19,12 @@ Future<void> showSaveBottomSheet(
BuildContext context, {
required Future<bool> Function() onUploadDocument,
}) {
- final colorScheme = getEnteColorScheme(context);
- return showModalBottomSheet<void>(
+ return showBottomSheetComponent<void>(
context: context,
- isScrollControlled: true,
- backgroundColor: colorScheme.backdropBase,
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(24),
- topRight: Radius.circular(24),
- ),
+ builder: (_) => SaveBottomSheet(
+ rootContext: context,
+ onUploadDocument: onUploadDocument,
),
- builder: (sheetContext) {
- return SaveBottomSheet(
- rootContext: context,
- onUploadDocument: onUploadDocument,
- );
- },
);
}
@@ -53,129 +42,88 @@ class SaveBottomSheet extends StatelessWidget {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final bottomInset = MediaQuery.of(context).viewInsets.bottom;
final maxHeight = MediaQuery.of(context).size.height * 0.75;
- return Container(
- decoration: BoxDecoration(
- color: colorScheme.backdropBase,
- border: Border(top: BorderSide(color: colorScheme.strokeFaint)),
- borderRadius: const BorderRadius.only(
- topLeft: Radius.circular(24),
- topRight: Radius.circular(24),
- ),
- ),
- child: SafeArea(
- top: false,
- child: Padding(
- padding: EdgeInsets.only(
- left: 16,
- right: 16,
- top: 20,
- bottom: bottomInset + 24,
+ return BottomSheetComponent(
+ title: context.l10n.saveToLocker,
+ content: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ context.l10n.informationDescription,
+ style: textTheme.smallMuted,
),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
+ const SizedBox(height: 24),
+ ConstrainedBox(
+ constraints: BoxConstraints(maxHeight: maxHeight),
+ child: SingleChildScrollView(
+ child: Column(
children: [
- Expanded(
- child: Padding(
- padding: const EdgeInsets.only(top: 12, left: 12),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- context.l10n.saveToLocker,
- style: textTheme.largeBold,
- ),
- const SizedBox(height: 12),
- Text(
- context.l10n.informationDescription,
- style: textTheme.smallMuted,
- ),
- ],
- ),
+ _buildSaveOption(
+ context,
+ rootContext: rootContext,
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedFileUpload,
+ size: 24,
+ color: colorScheme.primary700,
),
+ title: context.l10n.saveDocumentTitle,
+ description: context.l10n.saveDocumentDescription,
+ type: SaveOptionType.document,
+ colorScheme: colorScheme,
+ textTheme: textTheme,
),
- const CloseIconButton(),
- ],
- ),
- const SizedBox(height: 24),
- ConstrainedBox(
- constraints: BoxConstraints(maxHeight: maxHeight),
- child: SingleChildScrollView(
- child: Column(
- children: [
- _buildSaveOption(
- context,
- rootContext: rootContext,
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedFileUpload,
- size: 24,
- color: colorScheme.primary700,
- ),
- title: context.l10n.saveDocumentTitle,
- description: context.l10n.saveDocumentDescription,
- type: SaveOptionType.document,
- colorScheme: colorScheme,
- textTheme: textTheme,
- ),
- const SizedBox(height: 16),
- _buildSaveOption(
- context,
- rootContext: rootContext,
- icon: InfoItemUtils.getInfoIcon(
- InfoType.note,
- showBackground: false,
- size: 24,
- ),
- title: context.l10n.personalNote,
- description: context.l10n.personalNoteDescription,
- type: SaveOptionType.note,
- colorScheme: colorScheme,
- textTheme: textTheme,
- ),
- const SizedBox(height: 16),
- _buildSaveOption(
- context,
- rootContext: rootContext,
- icon: InfoItemUtils.getInfoIcon(
- InfoType.physicalRecord,
- showBackground: false,
- size: 24,
- ),
- title: context.l10n.physicalRecords,
- description: context.l10n.physicalRecordsDescription,
- type: SaveOptionType.physicalRecord,
- colorScheme: colorScheme,
- textTheme: textTheme,
- ),
- const SizedBox(height: 16),
- _buildSaveOption(
- context,
- rootContext: rootContext,
- icon: InfoItemUtils.getInfoIcon(
- InfoType.accountCredential,
- showBackground: false,
- size: 24,
- ),
- title: context.l10n.accountCredentials,
- description: context.l10n.accountCredentialsDescription,
- type: SaveOptionType.credentials,
- colorScheme: colorScheme,
- textTheme: textTheme,
- ),
- const SizedBox(height: 32),
- ],
+ const SizedBox(height: 16),
+ _buildSaveOption(
+ context,
+ rootContext: rootContext,
+ icon: InfoItemUtils.getInfoIcon(
+ InfoType.note,
+ showBackground: false,
+ size: 24,
+ ),
+ title: context.l10n.personalNote,
+ description: context.l10n.personalNoteDescription,
+ type: SaveOptionType.note,
+ colorScheme: colorScheme,
+ textTheme: textTheme,
),
- ),
+ const SizedBox(height: 16),
+ _buildSaveOption(
+ context,
+ rootContext: rootContext,
+ icon: InfoItemUtils.getInfoIcon(
+ InfoType.physicalRecord,
+ showBackground: false,
+ size: 24,
+ ),
+ title: context.l10n.physicalRecords,
+ description: context.l10n.physicalRecordsDescription,
+ type: SaveOptionType.physicalRecord,
+ colorScheme: colorScheme,
+ textTheme: textTheme,
+ ),
+ const SizedBox(height: 16),
+ _buildSaveOption(
+ context,
+ rootContext: rootContext,
+ icon: InfoItemUtils.getInfoIcon(
+ InfoType.accountCredential,
+ showBackground: false,
+ size: 24,
+ ),
+ title: context.l10n.accountCredentials,
+ description: context.l10n.accountCredentialsDescription,
+ type: SaveOptionType.credentials,
+ colorScheme: colorScheme,
+ textTheme: textTheme,
+ ),
+ ],
),
- ],
+ ),
),
- ),
+ ],
),
);
}