fix(mobile): closing editor goes back to main page (#22647)

Co-authored-by: bwees <brandonwees@gmail.com>
This commit is contained in:
Yaros 2025-10-06 22:56:35 +02:00 committed by GitHub
parent ad87dff18d
commit d02a82b618
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

View file

@ -50,6 +50,11 @@ class DriftEditImagePage extends ConsumerWidget {
return completer.future;
}
void _exitEditing(BuildContext context) {
// this assumes that the only way to get to this page is from the AssetViewerRoute
context.navigator.popUntil((route) => route.data?.name == AssetViewerRoute.name);
}
Future<void> _saveEditedImage(BuildContext context, BaseAsset asset, Image image, WidgetRef ref) async {
try {
final Uint8List imageData = await _imageToUint8List(image);
@ -66,7 +71,7 @@ class DriftEditImagePage extends ConsumerWidget {
}
ref.read(backgroundSyncProvider).syncLocal(full: true);
context.navigator.popUntil((route) => route.isFirst);
_exitEditing(context);
ImmichToast.show(durationInSecond: 3, context: context, msg: 'Image Saved!');
if (localAsset == null) {
@ -91,7 +96,7 @@ class DriftEditImagePage extends ConsumerWidget {
backgroundColor: context.scaffoldBackgroundColor,
leading: IconButton(
icon: Icon(Icons.close_rounded, color: context.primaryColor, size: 24),
onPressed: () => context.navigator.popUntil((route) => route.isFirst),
onPressed: () => _exitEditing(context),
),
actions: <Widget>[
TextButton(