Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][locker] Migrate dialogs to bottom sheets for consistent UI

AmanRajSinghMourya3b953cf62824
diff --git a/mobile/apps/locker/lib/ui/components/add_to_collection_dialog.dart b/mobile/apps/locker/lib/ui/components/add_to_collection_dialog.dart
deleted file mode 100644
index 9f9ddf29e2..0000000000
--- a/mobile/apps/locker/lib/ui/components/add_to_collection_dialog.dart
+++ /dev/null
@@ -1,168 +0,0 @@
-import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:ente_ui/utils/toast_util.dart";
-import "package:flutter/material.dart";
-import "package:locker/l10n/l10n.dart";
-import "package:locker/services/collections/models/collection.dart";
-import "package:locker/ui/components/collection_selection_widget.dart";
-import "package:locker/ui/components/gradient_button.dart";
-import "package:locker/utils/collection_list_util.dart";
-
-class AddToCollectionDialogResult {
- final List<Collection> selectedCollections;
-
- AddToCollectionDialogResult({
- required this.selectedCollections,
- });
-}
-
-class AddToCollectionDialog extends StatefulWidget {
- final List<Collection> collections;
- final BuildContext snackBarContext;
-
- const AddToCollectionDialog({
- super.key,
- required this.collections,
- required this.snackBarContext,
- });
-
- @override
- State<AddToCollectionDialog> createState() => _AddToCollectionDialogState();
-}
-
-class _AddToCollectionDialogState extends State<AddToCollectionDialog> {
- final Set<int> _selectedCollectionIds = <int>{};
- late List<Collection> _availableCollections;
-
- @override
- void initState() {
- super.initState();
- _availableCollections = uniqueCollectionsById(widget.collections);
- }
-
- void _toggleCollection(int collectionId) {
- setState(() {
- if (_selectedCollectionIds.contains(collectionId)) {
- _selectedCollectionIds.remove(collectionId);
- } else {
- _selectedCollectionIds.add(collectionId);
- }
- });
- }
-
- void _onCollectionsUpdated(List<Collection> updatedCollections) {
- setState(() {
- _availableCollections = uniqueCollectionsById(updatedCollections);
- });
- }
-
- Future<void> _onCancel() async {
- Navigator.of(context).pop();
- }
-
- Future<void> _onSave() async {
- final selectedCollections = _availableCollections
- .where((c) => _selectedCollectionIds.contains(c.id))
- .toList();
-
- if (selectedCollections.isEmpty) {
- showToast(
- widget.snackBarContext,
- widget.snackBarContext.l10n.pleaseSelectAtLeastOneCollection,
- );
- return;
- }
-
- Navigator.of(context).pop(
- AddToCollectionDialogResult(
- selectedCollections: selectedCollections,
- ),
- );
- }
-
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
-
- return Dialog(
- backgroundColor: colorScheme.backgroundElevated2,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(24),
- ),
- child: ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 360),
- child: Container(
- decoration: BoxDecoration(
- color: colorScheme.backgroundElevated2,
- borderRadius: BorderRadius.circular(24),
- boxShadow: [
- BoxShadow(
- color: Colors.black.withOpacity(0.08),
- blurRadius: 24,
- offset: const Offset(0, 12),
- ),
- ],
- ),
- padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 22),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- CollectionSelectionWidget(
- collections: _availableCollections,
- selectedCollectionIds: _selectedCollectionIds,
- onToggleCollection: _toggleCollection,
- onCollectionsUpdated: _onCollectionsUpdated,
- titleWidget: TitleBarTitleWidget(
- title: "Add to collection",
- trailingWidgets: [
- GestureDetector(
- onTap: _onCancel,
- child: Container(
- height: 36,
- width: 36,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: colorScheme.backgroundElevated,
- ),
- child: const Icon(
- Icons.close_rounded,
- size: 20,
- ),
- ),
- ),
- ],
- ),
- ),
- const SizedBox(height: 28),
- SizedBox(
- width: double.infinity,
- child: GradientButton(
- onTap: () async {
- await _onSave();
- },
- text: context.l10n.save,
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
-}
-
-Future<AddToCollectionDialogResult?> showAddToCollectionDialog(
- BuildContext context, {
- required List<Collection> collections,
- BuildContext? snackBarContext,
-}) async {
- final messengerContext = snackBarContext ?? context;
- return showDialog<AddToCollectionDialogResult>(
- context: context,
- builder: (dialogContext) => AddToCollectionDialog(
- collections: collections,
- snackBarContext: messengerContext,
- ),
- );
-}
diff --git a/mobile/apps/locker/lib/ui/components/add_to_collection_sheet.dart b/mobile/apps/locker/lib/ui/components/add_to_collection_sheet.dart
new file mode 100644
index 0000000000..6182bb3b93
--- /dev/null
+++ b/mobile/apps/locker/lib/ui/components/add_to_collection_sheet.dart
@@ -0,0 +1,120 @@
+import "package:ente_ui/components/base_bottom_sheet.dart";
+import "package:ente_ui/utils/toast_util.dart";
+import "package:flutter/material.dart";
+import "package:locker/l10n/l10n.dart";
+import "package:locker/services/collections/models/collection.dart";
+import "package:locker/ui/components/collection_selection_widget.dart";
+import "package:locker/ui/components/gradient_button.dart";
+import "package:locker/utils/collection_list_util.dart";
+
+class AddToCollectionDialogResult {
+ final List<Collection> selectedCollections;
+
+ AddToCollectionDialogResult({
+ required this.selectedCollections,
+ });
+}
+
+class AddToCollectionDialog extends StatefulWidget {
+ final List<Collection> collections;
+ final BuildContext snackBarContext;
+
+ const AddToCollectionDialog({
+ super.key,
+ required this.collections,
+ required this.snackBarContext,
+ });
+
+ @override
+ State<AddToCollectionDialog> createState() => _AddToCollectionDialogState();
+}
+
+class _AddToCollectionDialogState extends State<AddToCollectionDialog> {
+ final Set<int> _selectedCollectionIds = <int>{};
+ late List<Collection> _availableCollections;
+
+ @override
+ void initState() {
+ super.initState();
+ _availableCollections = uniqueCollectionsById(widget.collections);
+ }
+
+ void _toggleCollection(int collectionId) {
+ setState(() {
+ if (_selectedCollectionIds.contains(collectionId)) {
+ _selectedCollectionIds.remove(collectionId);
+ } else {
+ _selectedCollectionIds.add(collectionId);
+ }
+ });
+ }
+
+ void _onCollectionsUpdated(List<Collection> updatedCollections) {
+ setState(() {
+ _availableCollections = uniqueCollectionsById(updatedCollections);
+ });
+ }
+
+ Future<void> _onSave() async {
+ final selectedCollections = _availableCollections
+ .where((c) => _selectedCollectionIds.contains(c.id))
+ .toList();
+
+ if (selectedCollections.isEmpty) {
+ showToast(
+ widget.snackBarContext,
+ widget.snackBarContext.l10n.pleaseSelectAtLeastOneCollection,
+ );
+ return;
+ }
+
+ Navigator.of(context).pop(
+ AddToCollectionDialogResult(
+ selectedCollections: selectedCollections,
+ ),
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ CollectionSelectionWidget(
+ collections: _availableCollections,
+ selectedCollectionIds: _selectedCollectionIds,
+ onToggleCollection: _toggleCollection,
+ onCollectionsUpdated: _onCollectionsUpdated,
+ ),
+ const SizedBox(height: 28),
+ SizedBox(
+ width: double.infinity,
+ child: GradientButton(
+ onTap: () async {
+ await _onSave();
+ },
+ text: context.l10n.save,
+ ),
+ ),
+ ],
+ );
+ }
+}
+
+Future<AddToCollectionDialogResult?> showAddToCollectionDialog(
+ BuildContext context, {
+ required List<Collection> collections,
+ BuildContext? snackBarContext,
+}) async {
+ final messengerContext = snackBarContext ?? context;
+ return showBaseBottomSheet<AddToCollectionDialogResult>(
+ context,
+ title: context.l10n.addToCollection,
+ headerSpacing: 20,
+ child: AddToCollectionDialog(
+ collections: collections,
+ snackBarContext: messengerContext,
+ ),
+ );
+}
diff --git a/mobile/apps/locker/lib/ui/components/file_edit_dialog.dart b/mobile/apps/locker/lib/ui/components/file_edit_sheet.dart
similarity index 56%
rename from mobile/apps/locker/lib/ui/components/file_edit_dialog.dart
rename to mobile/apps/locker/lib/ui/components/file_edit_sheet.dart
index b5950ad38b..06b1c44bdb 100644
--- a/mobile/apps/locker/lib/ui/components/file_edit_dialog.dart
+++ b/mobile/apps/locker/lib/ui/components/file_edit_sheet.dart
@@ -1,4 +1,4 @@
-import "package:ente_ui/components/title_bar_title_widget.dart";
+import 'package:ente_ui/components/base_bottom_sheet.dart';
import 'package:ente_ui/theme/ente_theme.dart';
import 'package:flutter/material.dart';
import 'package:locker/l10n/l10n.dart';
@@ -115,10 +115,6 @@ class _FileEditDialogState extends State<FileEditDialog> {
return filtered;
}
- Future<void> _onCancel() async {
- Navigator.of(context).pop();
- }
-
Future<void> _onSave() async {
final selectedCollections = _availableCollections
.where((c) => _selectedCollectionIds.contains(c.id))
@@ -135,95 +131,43 @@ class _FileEditDialogState extends State<FileEditDialog> {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- return Dialog(
- backgroundColor: colorScheme.backgroundElevated2,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(24),
- ),
- child: Container(
- decoration: BoxDecoration(
- color: colorScheme.backgroundElevated2,
- borderRadius: BorderRadius.circular(24),
- boxShadow: [
- BoxShadow(
- color: Colors.black.withValues(alpha: 0.08),
- blurRadius: 24,
- offset: const Offset(0, 12),
- ),
- ],
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ FormTextInputWidget(
+ controller: _titleController,
+ labelText: context.l10n.title,
+ hintText: context.l10n.enterNewTitle,
+ maxLength: 200,
+ shouldUseTextInputWidget: false,
),
- padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 22),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- TitleBarTitleWidget(
- title: context.l10n.editItem,
- ),
- ],
- ),
- ),
- GestureDetector(
- onTap: _onCancel,
- child: Container(
- height: 36,
- width: 36,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: colorScheme.backgroundElevated,
- ),
- child: const Icon(
- Icons.close_rounded,
- size: 20,
- ),
- ),
- ),
- ],
- ),
- const SizedBox(height: 24),
- FormTextInputWidget(
- controller: _titleController,
- labelText: context.l10n.title,
- hintText: context.l10n.enterNewTitle,
- maxLength: 200,
- shouldUseTextInputWidget: false,
+ const SizedBox(height: 24),
+ CollectionSelectionWidget(
+ collections: _availableCollections,
+ selectedCollectionIds: _selectedCollectionIds,
+ onToggleCollection: _toggleCollection,
+ onCollectionsUpdated: _onCollectionsUpdated,
+ titleWidget: Text(
+ context.l10n.collections,
+ style: textTheme.body.copyWith(
+ fontWeight: FontWeight.w600,
),
- const SizedBox(height: 24),
- CollectionSelectionWidget(
- collections: _availableCollections,
- selectedCollectionIds: _selectedCollectionIds,
- onToggleCollection: _toggleCollection,
- onCollectionsUpdated: _onCollectionsUpdated,
- titleWidget: Text(
- context.l10n.collections,
- style: textTheme.body.copyWith(
- fontWeight: FontWeight.w600,
- ),
- ),
- ),
- const SizedBox(height: 28),
- SizedBox(
- width: double.infinity,
- child: GradientButton(
- onTap: () async {
- await _onSave();
- },
- text: context.l10n.save,
- ),
- ),
- ],
+ ),
+ ),
+ const SizedBox(height: 28),
+ SizedBox(
+ width: double.infinity,
+ child: GradientButton(
+ onTap: () async {
+ await _onSave();
+ },
+ text: context.l10n.save,
+ ),
),
- ),
+ ],
);
}
}
@@ -234,9 +178,12 @@ Future<FileEditDialogResult?> showFileEditDialog(
required List<Collection> collections,
BuildContext? snackBarContext,
}) async {
- return showDialog<FileEditDialogResult>(
- context: context,
- builder: (dialogContext) => FileEditDialog(
+ return showBaseBottomSheet<FileEditDialogResult>(
+ context,
+ title: context.l10n.editItem,
+ headerSpacing: 20,
+ isKeyboardAware: true,
+ child: FileEditDialog(
file: file,
collections: collections,
snackBarContext: snackBarContext ?? context,
diff --git a/mobile/apps/locker/lib/ui/components/file_restore_dialog.dart b/mobile/apps/locker/lib/ui/components/file_restore_dialog.dart
deleted file mode 100644
index 54eda2fa7c..0000000000
--- a/mobile/apps/locker/lib/ui/components/file_restore_dialog.dart
+++ /dev/null
@@ -1,164 +0,0 @@
-import "package:ente_ui/components/title_bar_title_widget.dart";
-import 'package:ente_ui/theme/ente_theme.dart';
-import 'package:ente_ui/utils/toast_util.dart';
-import 'package:flutter/material.dart';
-import 'package:locker/l10n/l10n.dart';
-import 'package:locker/services/collections/models/collection.dart';
-import 'package:locker/services/files/sync/models/file.dart';
-import 'package:locker/ui/components/collection_selection_widget.dart';
-import "package:locker/ui/components/gradient_button.dart";
-
-class FileRestoreDialogResult {
- final List<Collection> selectedCollections;
-
- const FileRestoreDialogResult({
- required this.selectedCollections,
- });
-}
-
-class FileRestoreDialog extends StatefulWidget {
- final EnteFile file;
- final List<Collection> collections;
-
- const FileRestoreDialog({
- super.key,
- required this.file,
- required this.collections,
- });
-
- @override
- State<FileRestoreDialog> createState() => _FileRestoreDialogState();
-}
-
-class _FileRestoreDialogState extends State<FileRestoreDialog> {
- final Set<int> _selectedCollectionIds = <int>{};
- late List<Collection> _availableCollections;
-
- @override
- void initState() {
- super.initState();
- _availableCollections = List.from(widget.collections);
- }
-
- void _toggleCollection(int collectionId) {
- setState(() {
- if (_selectedCollectionIds.contains(collectionId)) {
- _selectedCollectionIds.remove(collectionId);
- } else {
- _selectedCollectionIds.add(collectionId);
- }
- });
- }
-
- void _onCollectionsUpdated(List<Collection> updatedCollections) {
- setState(() {
- _availableCollections = updatedCollections;
- });
- }
-
- Future<void> _onCancel() async {
- Navigator.of(context).pop();
- }
-
- Future<void> _onRestore() async {
- final selectedCollections = _availableCollections
- .where((c) => _selectedCollectionIds.contains(c.id))
- .toList();
-
- if (selectedCollections.isEmpty) {
- showToast(
- context,
- context.l10n.pleaseSelectAtLeastOneCollection,
- );
- return;
- }
-
- Navigator.of(context).pop(
- FileRestoreDialogResult(selectedCollections: selectedCollections),
- );
- }
-
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
-
- return Dialog(
- backgroundColor: colorScheme.backgroundElevated2,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(24),
- ),
- child: ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 360),
- child: Container(
- decoration: BoxDecoration(
- color: colorScheme.backgroundElevated2,
- borderRadius: BorderRadius.circular(24),
- boxShadow: [
- BoxShadow(
- color: Colors.black.withOpacity(0.08),
- blurRadius: 24,
- offset: const Offset(0, 12),
- ),
- ],
- ),
- padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 22),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- CollectionSelectionWidget(
- collections: _availableCollections,
- selectedCollectionIds: _selectedCollectionIds,
- onToggleCollection: _toggleCollection,
- onCollectionsUpdated: _onCollectionsUpdated,
- singleSelectionMode: true,
- titleWidget: TitleBarTitleWidget(
- title: "Restore",
- trailingWidgets: [
- GestureDetector(
- onTap: _onCancel,
- child: Container(
- height: 36,
- width: 36,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: colorScheme.backgroundElevated,
- ),
- child: const Icon(
- Icons.close_rounded,
- size: 20,
- ),
- ),
- ),
- ],
- ),
- ),
- const SizedBox(height: 28),
- SizedBox(
- width: double.infinity,
- child: GradientButton(
- onTap: _onRestore,
- text: context.l10n.restore,
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
-}
-
-Future<FileRestoreDialogResult?> showFileRestoreDialog(
- BuildContext context, {
- required EnteFile file,
- required List<Collection> collections,
-}) {
- return showDialog<FileRestoreDialogResult>(
- context: context,
- builder: (context) => FileRestoreDialog(
- file: file,
- collections: collections,
- ),
- );
-}
diff --git a/mobile/apps/locker/lib/ui/components/file_restore_sheet.dart b/mobile/apps/locker/lib/ui/components/file_restore_sheet.dart
new file mode 100644
index 0000000000..3a42837495
--- /dev/null
+++ b/mobile/apps/locker/lib/ui/components/file_restore_sheet.dart
@@ -0,0 +1,116 @@
+import 'package:ente_ui/components/base_bottom_sheet.dart';
+import 'package:ente_ui/utils/toast_util.dart';
+import 'package:flutter/material.dart';
+import 'package:locker/l10n/l10n.dart';
+import 'package:locker/services/collections/models/collection.dart';
+import 'package:locker/services/files/sync/models/file.dart';
+import 'package:locker/ui/components/collection_selection_widget.dart';
+import "package:locker/ui/components/gradient_button.dart";
+
+class FileRestoreDialogResult {
+ final List<Collection> selectedCollections;
+
+ const FileRestoreDialogResult({
+ required this.selectedCollections,
+ });
+}
+
+class FileRestoreDialog extends StatefulWidget {
+ final EnteFile file;
+ final List<Collection> collections;
+
+ const FileRestoreDialog({
+ super.key,
+ required this.file,
+ required this.collections,
+ });
+
+ @override
+ State<FileRestoreDialog> createState() => _FileRestoreDialogState();
+}
+
+class _FileRestoreDialogState extends State<FileRestoreDialog> {
+ final Set<int> _selectedCollectionIds = <int>{};
+ late List<Collection> _availableCollections;
+
+ @override
+ void initState() {
+ super.initState();
+ _availableCollections = List.from(widget.collections);
+ }
+
+ void _toggleCollection(int collectionId) {
+ setState(() {
+ if (_selectedCollectionIds.contains(collectionId)) {
+ _selectedCollectionIds.remove(collectionId);
+ } else {
+ _selectedCollectionIds.add(collectionId);
+ }
+ });
+ }
+
+ void _onCollectionsUpdated(List<Collection> updatedCollections) {
+ setState(() {
+ _availableCollections = updatedCollections;
+ });
+ }
+
+ Future<void> _onRestore() async {
+ final selectedCollections = _availableCollections
+ .where((c) => _selectedCollectionIds.contains(c.id))
+ .toList();
+
+ if (selectedCollections.isEmpty) {
+ showToast(
+ context,
+ context.l10n.pleaseSelectAtLeastOneCollection,
+ );
+ return;
+ }
+
+ Navigator.of(context).pop(
+ FileRestoreDialogResult(selectedCollections: selectedCollections),
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ CollectionSelectionWidget(
+ collections: _availableCollections,
+ selectedCollectionIds: _selectedCollectionIds,
+ onToggleCollection: _toggleCollection,
+ onCollectionsUpdated: _onCollectionsUpdated,
+ singleSelectionMode: true,
+ ),
+ const SizedBox(height: 28),
+ SizedBox(
+ width: double.infinity,
+ child: GradientButton(
+ onTap: _onRestore,
+ text: context.l10n.restore,
+ ),
+ ),
+ ],
+ );
+ }
+}
+
+Future<FileRestoreDialogResult?> showFileRestoreDialog(
+ BuildContext context, {
+ required EnteFile file,
+ required List<Collection> collections,
+}) {
+ return showBaseBottomSheet<FileRestoreDialogResult>(
+ context,
+ title: context.l10n.restore,
+ headerSpacing: 20,
+ child: FileRestoreDialog(
+ file: file,
+ collections: collections,
+ ),
+ );
+}
diff --git a/mobile/apps/locker/lib/ui/components/file_upload_dialog.dart b/mobile/apps/locker/lib/ui/components/file_upload_sheet.dart
similarity index 54%
rename from mobile/apps/locker/lib/ui/components/file_upload_dialog.dart
rename to mobile/apps/locker/lib/ui/components/file_upload_sheet.dart
index dd30ba11df..58a30e3ba6 100644
--- a/mobile/apps/locker/lib/ui/components/file_upload_dialog.dart
+++ b/mobile/apps/locker/lib/ui/components/file_upload_sheet.dart
@@ -1,9 +1,9 @@
import 'dart:io';
+import 'package:ente_ui/components/base_bottom_sheet.dart';
import 'package:ente_ui/components/buttons/button_widget.dart';
import 'package:ente_ui/components/buttons/models/button_type.dart';
import 'package:ente_ui/components/text_input_widget.dart';
-import "package:ente_ui/components/title_bar_title_widget.dart";
import 'package:ente_ui/theme/ente_theme.dart';
import 'package:ente_ui/utils/toast_util.dart';
import 'package:flutter/material.dart';
@@ -75,10 +75,6 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
});
}
- Future<void> _onCancel() async {
- Navigator.of(context).pop();
- }
-
Future<void> _onSave() async {
final selectedCollections = _availableCollections
.where((c) => _selectedCollectionIds.contains(c.id))
@@ -109,81 +105,60 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- return Dialog(
- backgroundColor: colorScheme.backgroundElevated2,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(24),
- ),
- child: Container(
- width: 400,
- constraints: const BoxConstraints(maxHeight: 600),
- padding: const EdgeInsets.all(20),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
children: [
- Row(
- children: [
- FileIconUtils.getFileIcon(
- _fileName,
- size: 24,
- showBackground: false,
- ),
- const SizedBox(width: 8),
- Expanded(
- child: TitleBarTitleWidget(
- title: _fileName,
- ),
- ),
- ],
- ),
- const SizedBox(height: 20),
- CollectionSelectionWidget(
- collections: _availableCollections,
- selectedCollectionIds: _selectedCollectionIds,
- onToggleCollection: _toggleCollection,
- onCollectionsUpdated: _onCollectionsUpdated,
+ FileIconUtils.getFileIcon(
+ _fileName,
+ size: 24,
+ showBackground: false,
),
- const SizedBox(height: 16),
- Text(
- 'Note',
- style: textTheme.small.copyWith(
- color: colorScheme.textBase,
+ const SizedBox(width: 8),
+ Expanded(
+ child: Text(
+ _fileName,
+ style: textTheme.body,
+ overflow: TextOverflow.ellipsis,
),
),
- const SizedBox(height: 8),
- TextInputWidget(
- hintText: context.l10n.optionalNote,
- initialValue: _noteController.text,
- onChange: (value) => _noteController.text = value,
- maxLength: 500,
- textCapitalization: TextCapitalization.sentences,
- ),
- const SizedBox(height: 20),
- Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- Flexible(
- child: ButtonWidget(
- buttonType: ButtonType.secondary,
- labelText: context.l10n.cancel,
- onTap: _onCancel,
- ),
- ),
- const SizedBox(width: 12),
- Flexible(
- child: ButtonWidget(
- buttonType: ButtonType.primary,
- labelText: context.l10n.upload,
- onTap: _onSave,
- isDisabled: _selectedCollectionIds.isEmpty,
- ),
- ),
- ],
- ),
],
),
- ),
+ const SizedBox(height: 20),
+ CollectionSelectionWidget(
+ collections: _availableCollections,
+ selectedCollectionIds: _selectedCollectionIds,
+ onToggleCollection: _toggleCollection,
+ onCollectionsUpdated: _onCollectionsUpdated,
+ ),
+ const SizedBox(height: 16),
+ Text(
+ 'Note',
+ style: textTheme.small.copyWith(
+ color: colorScheme.textBase,
+ ),
+ ),
+ const SizedBox(height: 8),
+ TextInputWidget(
+ hintText: context.l10n.optionalNote,
+ initialValue: _noteController.text,
+ onChange: (value) => _noteController.text = value,
+ maxLength: 500,
+ textCapitalization: TextCapitalization.sentences,
+ ),
+ const SizedBox(height: 20),
+ SizedBox(
+ width: double.infinity,
+ child: ButtonWidget(
+ buttonType: ButtonType.primary,
+ labelText: context.l10n.upload,
+ onTap: _onSave,
+ isDisabled: _selectedCollectionIds.isEmpty,
+ ),
+ ),
+ ],
);
}
}
@@ -194,10 +169,12 @@ Future<FileUploadDialogResult?> showFileUploadDialog(
required List<Collection> collections,
Collection? selectedCollection,
}) async {
- return showDialog<FileUploadDialogResult>(
- context: context,
- barrierColor: getEnteColorScheme(context).backdropBase,
- builder: (context) => FileUploadDialog(
+ return showBaseBottomSheet<FileUploadDialogResult>(
+ context,
+ title: context.l10n.upload,
+ headerSpacing: 20,
+ isKeyboardAware: true,
+ child: FileUploadDialog(
file: file,
collections: collections,
selectedCollection: selectedCollection,
diff --git a/mobile/apps/locker/lib/ui/components/input_dialog_sheet.dart b/mobile/apps/locker/lib/ui/components/input_sheet.dart
similarity index 96%
rename from mobile/apps/locker/lib/ui/components/input_dialog_sheet.dart
rename to mobile/apps/locker/lib/ui/components/input_sheet.dart
index 029f74bfde..4b1a44d58d 100644
--- a/mobile/apps/locker/lib/ui/components/input_dialog_sheet.dart
+++ b/mobile/apps/locker/lib/ui/components/input_sheet.dart
@@ -94,7 +94,6 @@ class _InputDialogSheetState extends State<InputDialogSheet> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- const SizedBox(height: 16),
TextField(
controller: _textController,
autofocus: true,
@@ -128,7 +127,7 @@ class _InputDialogSheetState extends State<InputDialogSheet> {
),
onSubmitted: (_) => _onSubmit(),
),
- const SizedBox(height: 24),
+ const SizedBox(height: 36),
SizedBox(
width: double.infinity,
child: GradientButton(
@@ -141,7 +140,7 @@ class _InputDialogSheetState extends State<InputDialogSheet> {
}
}
-Future<dynamic> showInputSheet(
+Future<dynamic> showInputDialogSheet(
BuildContext context, {
required String title,
required String hintText,
@@ -151,9 +150,10 @@ Future<dynamic> showInputSheet(
TextCapitalization textCapitalization = TextCapitalization.words,
int? maxLength = 200,
}) async {
- final result = await showBaseBottomSheet<dynamic>(
+ return showBaseBottomSheet<dynamic>(
context,
title: title,
+ headerSpacing: 20,
isKeyboardAware: true,
child: InputDialogSheet(
title: title,
@@ -165,6 +165,4 @@ Future<dynamic> showInputSheet(
maxLength: maxLength,
),
);
-
- return result;
}
diff --git a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart
index 6dbd8e6453..d20daecf8d 100644
--- a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart
+++ b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart
@@ -10,7 +10,7 @@ import "package:hugeicons/hugeicons.dart";
import "package:locker/extensions/collection_extension.dart";
import 'package:locker/l10n/l10n.dart';
import 'package:locker/services/collections/models/collection.dart';
-import 'package:locker/ui/components/file_upload_dialog.dart';
+import 'package:locker/ui/components/file_upload_sheet.dart';
import "package:locker/ui/components/gradient_button.dart";
import 'package:locker/utils/collection_actions.dart';
import "package:locker/utils/file_icon_utils.dart";
diff --git a/mobile/apps/locker/lib/ui/pages/trash_page.dart b/mobile/apps/locker/lib/ui/pages/trash_page.dart
index 291af4829b..8f2a89e800 100644
--- a/mobile/apps/locker/lib/ui/pages/trash_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/trash_page.dart
@@ -12,6 +12,7 @@ import 'package:locker/services/trash/models/trash_file.dart';
import 'package:locker/services/trash/trash_service.dart';
import "package:locker/ui/components/delete_confirmation_sheet.dart";
import "package:locker/ui/components/empty_state_widget.dart";
+import 'package:locker/ui/components/file_restore_sheet.dart';
import 'package:locker/ui/components/item_list_view.dart';
class TrashPage extends StatefulWidget {
diff --git a/mobile/apps/locker/lib/ui/pages/uploader_page.dart b/mobile/apps/locker/lib/ui/pages/uploader_page.dart
index 2b405e1609..7b893a5681 100644
--- a/mobile/apps/locker/lib/ui/pages/uploader_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/uploader_page.dart
@@ -12,7 +12,7 @@ import 'package:locker/services/collections/collections_service.dart';
import 'package:locker/services/collections/models/collection.dart';
import 'package:locker/services/files/sync/metadata_updater_service.dart';
import 'package:locker/services/files/upload/file_upload_service.dart';
-import 'package:locker/ui/components/file_upload_dialog.dart';
+import 'package:locker/ui/components/file_upload_sheet.dart';
import 'package:locker/ui/pages/file_upload_screen.dart';
import 'package:logging/logging.dart';
diff --git a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
index 0b6c455743..49c43d818b 100644
--- a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
+++ b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
@@ -14,7 +14,7 @@ import "package:locker/services/collections/models/collection_view_type.dart";
import "package:locker/services/configuration.dart";
import "package:locker/services/favorites_service.dart";
import "package:locker/services/files/sync/models/file.dart";
-import "package:locker/ui/components/add_to_collection_dialog.dart";
+import "package:locker/ui/components/add_to_collection_sheet.dart";
import "package:locker/ui/components/delete_confirmation_sheet.dart";
import "package:locker/ui/components/selection_action_button_widget.dart";
import "package:locker/utils/collection_list_util.dart";
diff --git a/mobile/apps/locker/lib/utils/collection_actions.dart b/mobile/apps/locker/lib/utils/collection_actions.dart
index b0e8f5f9e0..65980bba24 100644
--- a/mobile/apps/locker/lib/utils/collection_actions.dart
+++ b/mobile/apps/locker/lib/utils/collection_actions.dart
@@ -21,7 +21,7 @@ import "package:locker/services/configuration.dart";
import "package:locker/services/trash/trash_service.dart";
import "package:locker/ui/components/delete_confirmation_sheet.dart";
import "package:locker/ui/components/gradient_button.dart";
-import "package:locker/ui/components/input_dialog_sheet.dart";
+import "package:locker/ui/components/input_sheet.dart";
import "package:locker/ui/components/subscription_required_dialog.dart";
import 'package:logging/logging.dart';
diff --git a/mobile/apps/locker/lib/utils/file_actions.dart b/mobile/apps/locker/lib/utils/file_actions.dart
index e39651d037..c4bda9f4fe 100644
--- a/mobile/apps/locker/lib/utils/file_actions.dart
+++ b/mobile/apps/locker/lib/utils/file_actions.dart
@@ -14,7 +14,7 @@ import "package:locker/services/files/sync/models/file.dart";
import "package:locker/services/info_file_service.dart";
import "package:locker/services/trash/trash_service.dart";
import "package:locker/ui/components/delete_confirmation_sheet.dart";
-import "package:locker/ui/components/file_edit_dialog.dart";
+import "package:locker/ui/components/file_edit_sheet.dart";
import "package:locker/ui/components/share_link_dialog.dart";
import "package:locker/ui/components/subscription_required_dialog.dart";
import "package:locker/ui/pages/account_credentials_page.dart";
diff --git a/mobile/packages/accounts/lib/pages/delete_account_page.dart b/mobile/packages/accounts/lib/pages/delete_account_page.dart
index 49bbb9dc84..71d069bc7c 100644
--- a/mobile/packages/accounts/lib/pages/delete_account_page.dart
+++ b/mobile/packages/accounts/lib/pages/delete_account_page.dart
@@ -5,7 +5,10 @@ import 'package:ente_configuration/base_configuration.dart';
import 'package:ente_crypto_api/ente_crypto_api.dart';
import 'package:ente_lock_screen/local_authentication_service.dart';
import 'package:ente_strings/ente_strings.dart';
+import 'package:ente_ui/components/base_bottom_sheet.dart';
+import 'package:ente_ui/components/buttons/button_widget.dart';
import 'package:ente_ui/components/buttons/gradient_button.dart';
+import 'package:ente_ui/components/buttons/models/button_type.dart';
import 'package:ente_ui/components/dialogs.dart';
import 'package:ente_ui/theme/ente_theme.dart';
import 'package:ente_utils/email_util.dart';
@@ -187,73 +190,59 @@ class DeleteAccountPage extends StatelessWidget {
}
Future<void> _requestEmailForDeletion(BuildContext context) async {
- final AlertDialog alert = AlertDialog(
- title: Text(
- context.strings.deleteAccount,
- style: const TextStyle(
- color: Colors.red,
- ),
- ),
- content: RichText(
- text: TextSpan(
- children: [
- const TextSpan(
- text: "Please send an email to ",
- ),
- TextSpan(
- style: TextStyle(
- color: Colors.orange[300],
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+
+ await showBaseBottomSheet(
+ context,
+ title: context.strings.deleteAccount,
+ headerSpacing: 20,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ RichText(
+ textAlign: TextAlign.center,
+ text: TextSpan(
+ children: [
+ const TextSpan(
+ text: "Please send an email to ",
+ ),
+ TextSpan(
+ style: TextStyle(
+ color: Colors.orange[300],
+ ),
+ ),
+ const TextSpan(
+ text:
+ " from your registered email address.\n\nYour request will be processed within 72 hours.",
+ ),
+ ],
+ style: textTheme.body.copyWith(
+ color: colorScheme.textBase,
+ height: 1.5,
),
),
- const TextSpan(
- text:
- " from your registered email address.\n\nYour request will be processed within 72 hours.",
- ),
- ],
- style: TextStyle(
- color: getEnteColorScheme(context).surface,
- height: 1.5,
- fontSize: 16,
),
- ),
- ),
- actions: [
- TextButton(
- child: Text(
- context.strings.sendEmail,
- style: const TextStyle(
- color: Colors.red,
- ),
- ),
- onPressed: () async {
- Navigator.of(context, rootNavigator: true).pop('dialog');
- await sendEmail(
- context,
- subject: '[Delete account]',
- );
- },
- ),
- TextButton(
- child: Text(
- context.strings.ok,
- style: TextStyle(
- color: getEnteColorScheme(context).surface,
+ const SizedBox(height: 24),
+ SizedBox(
+ width: double.infinity,
+ child: ButtonWidget(
+ buttonType: ButtonType.critical,
+ labelText: context.strings.sendEmail,
+ onTap: () async {
+ Navigator.of(context).pop();
+ await sendEmail(
+ context,
+ subject: '[Delete account]',
+ );
+ },
),
),
- onPressed: () {
- Navigator.of(context, rootNavigator: true).pop('dialog');
- },
- ),
- ],
- );
- // ignore: unawaited_futures
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return alert;
- },
+ ],
+ ),
);
}
}
diff --git a/mobile/packages/accounts/lib/pages/sessions_page.dart b/mobile/packages/accounts/lib/pages/sessions_page.dart
index 406f325ef9..c38701922a 100644
--- a/mobile/packages/accounts/lib/pages/sessions_page.dart
+++ b/mobile/packages/accounts/lib/pages/sessions_page.dart
@@ -2,6 +2,9 @@ import 'package:ente_accounts/ente_accounts.dart';
import 'package:ente_configuration/base_configuration.dart';
import 'package:ente_pure_utils/ente_pure_utils.dart';
import 'package:ente_strings/ente_strings.dart';
+import 'package:ente_ui/components/base_bottom_sheet.dart';
+import 'package:ente_ui/components/buttons/button_widget.dart';
+import 'package:ente_ui/components/buttons/models/button_type.dart';
import 'package:ente_ui/components/centered_constrained_widget.dart';
import 'package:ente_ui/components/loading_widget.dart';
import 'package:ente_ui/theme/ente_theme.dart';
@@ -154,68 +157,50 @@ class _SessionsPageState extends State<SessionsPage> {
void _showSessionTerminationDialog(Session session) {
final isLoggingOutFromThisDevice =
session.token == widget.config.getToken();
- Widget text;
- if (isLoggingOutFromThisDevice) {
- text = Text(
- context.strings.thisWillLogYouOutOfThisDevice,
- );
- } else {
- text = SingleChildScrollView(
- child: Column(
- children: [
+ final textTheme = getEnteTextTheme(context);
+
+ showBaseBottomSheet(
+ context,
+ title: context.strings.terminateSession,
+ headerSpacing: 20,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ if (isLoggingOutFromThisDevice)
+ Text(
+ context.strings.thisWillLogYouOutOfThisDevice,
+ style: textTheme.body,
+ )
+ else ...[
Text(
context.strings.thisWillLogYouOutOfTheFollowingDevice,
+ style: textTheme.body,
),
- const Padding(padding: EdgeInsets.all(8)),
+ const SizedBox(height: 8),
Text(
session.ua,
- style: Theme.of(context).textTheme.bodySmall,
+ style: textTheme.small,
),
],
- ),
- );
- }
- final AlertDialog alert = AlertDialog(
- title: Text(context.strings.terminateSession),
- content: text,
- actions: [
- TextButton(
- child: Text(
- context.strings.terminate,
- style: const TextStyle(
- color: Colors.red,
+ const SizedBox(height: 24),
+ SizedBox(
+ width: double.infinity,
+ child: ButtonWidget(
+ buttonType: ButtonType.critical,
+ labelText: context.strings.terminate,
+ onTap: () async {
+ Navigator.of(context).pop();
+ if (isLoggingOutFromThisDevice) {
+ await UserService.instance.logout(context);
+ } else {
+ await _terminateSession(session);
+ }
+ },
),
),
- onPressed: () async {
- Navigator.of(context, rootNavigator: true).pop('dialog');
- if (isLoggingOutFromThisDevice) {
- await UserService.instance.logout(context);
- } else {
- await _terminateSession(session);
- }
- },
- ),
- TextButton(
- child: Text(
- context.strings.cancel,
- style: TextStyle(
- color: isLoggingOutFromThisDevice
- ? getEnteColorScheme(context).alternativeColor
- : getEnteColorScheme(context).textBase,
- ),
- ),
- onPressed: () {
- Navigator.of(context, rootNavigator: true).pop('dialog');
- },
- ),
- ],
- );
-
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return alert;
- },
+ ],
+ ),
);
}