Skip to content

Commit

Permalink
[mob][photos] Fix buggy create album
Browse files Browse the repository at this point in the history
  • Loading branch information
ashilkn committed Oct 21, 2024
1 parent 4edbc69 commit 1a92a9e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions mobile/lib/ui/collections/new_album_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -44,17 +44,19 @@ 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);
rethrow;
}
},
);

if (result is Exception) {
await showGenericErrorDialog(context: context, error: result);
}
Expand Down
4 changes: 3 additions & 1 deletion mobile/lib/ui/components/dialog_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -200,6 +201,7 @@ class TextInputDialog extends StatefulWidget {
this.textEditingController,
this.textInputFormatter,
this.textInputType,
this.popnavAfterSubmission = true,
super.key,
});

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions mobile/lib/utils/dialog_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ Future<dynamic> showTextInputDialog(
List<TextInputFormatter>? textInputFormatter,
TextInputType? textInputType,
bool useRootNavigator = false,
bool popnavAfterSubmission = true,
}) {
return showDialog(
barrierColor: backdropFaintDark,
Expand Down Expand Up @@ -388,6 +389,7 @@ Future<dynamic> showTextInputDialog(
textEditingController: textEditingController,
textInputFormatter: textInputFormatter,
textInputType: textInputType,
popnavAfterSubmission: popnavAfterSubmission,
),
),
);
Expand Down

0 comments on commit 1a92a9e

Please sign in to comment.