Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Fix buggy create album

ashilkn1a92a9e967e6
diff --git a/mobile/lib/ui/collections/new_album_icon.dart b/mobile/lib/ui/collections/new_album_icon.dart
index 01d871210f..61b7355a9f 100644
--- a/mobile/lib/ui/collections/new_album_icon.dart
+++ b/mobile/lib/ui/collections/new_album_icon.dart
@@ -34,8 +34,8 @@ class NewAlbumIcon extends StatelessWidget {
alwaysShowSuccessState: false,
initialValue: "",
textCapitalization: TextCapitalization.words,
+ popnavAfterSubmission: false,
onSubmit: (String text) async {
- // indicates user cancelled the rename request
if (text.trim() == "") {
return;
}
@@ -44,10 +44,11 @@ class NewAlbumIcon extends StatelessWidget {
final Collection c =
await CollectionsService.instance.createAlbum(text);
// ignore: unawaited_futures
- routeToPage(
+ await routeToPage(
context,
CollectionPage(CollectionWithThumbnail(c, null)),
);
+ Navigator.of(context).pop();
} catch (e, s) {
Logger("CreateNewAlbumIcon")
.severe("Failed to rename album", e, s);
@@ -55,6 +56,7 @@ class NewAlbumIcon extends StatelessWidget {
}
},
);
+
if (result is Exception) {
await showGenericErrorDialog(context: context, error: result);
}
diff --git a/mobile/lib/ui/components/dialog_widget.dart b/mobile/lib/ui/components/dialog_widget.dart
index 1567151401..2d8fe96b75 100644
--- a/mobile/lib/ui/components/dialog_widget.dart
+++ b/mobile/lib/ui/components/dialog_widget.dart
@@ -180,6 +180,7 @@ class TextInputDialog extends StatefulWidget {
final TextEditingController? textEditingController;
final List<TextInputFormatter>? textInputFormatter;
final TextInputType? textInputType;
+ final bool popnavAfterSubmission;
const TextInputDialog({
required this.title,
this.body,
@@ -200,6 +201,7 @@ class TextInputDialog extends StatefulWidget {
this.textEditingController,
this.textInputFormatter,
this.textInputType,
+ this.popnavAfterSubmission = true,
super.key,
});
@@ -273,7 +275,7 @@ class _TextInputDialogState extends State<TextInputDialog> {
maxLength: widget.maxLength,
submitNotifier: _submitNotifier,
onSubmit: widget.onSubmit,
- popNavAfterSubmission: true,
+ popNavAfterSubmission: widget.popnavAfterSubmission,
showOnlyLoadingState: widget.showOnlyLoadingState,
textCapitalization: widget.textCapitalization,
alwaysShowSuccessState: widget.alwaysShowSuccessState,
diff --git a/mobile/lib/utils/dialog_util.dart b/mobile/lib/utils/dialog_util.dart
index 1274d6d8b0..f72af1c9a7 100644
--- a/mobile/lib/utils/dialog_util.dart
+++ b/mobile/lib/utils/dialog_util.dart
@@ -357,6 +357,7 @@ Future<dynamic> showTextInputDialog(
List<TextInputFormatter>? textInputFormatter,
TextInputType? textInputType,
bool useRootNavigator = false,
+ bool popnavAfterSubmission = true,
}) {
return showDialog(
barrierColor: backdropFaintDark,
@@ -388,6 +389,7 @@ Future<dynamic> showTextInputDialog(
textEditingController: textEditingController,
textInputFormatter: textInputFormatter,
textInputType: textInputType,
+ popnavAfterSubmission: popnavAfterSubmission,
),
),
);