Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions mobile/lib/presentation/pages/editing/drift_edit.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/presentation/pages/editing/drift_edit.page.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/images/image_provider.dart';
import 'package:immich_mobile/providers/infrastructure/asset_viewer/current_asset.provider.dart';
import 'package:immich_mobile/routing/router.dart';

class EditImageActionButton extends ConsumerWidget {
const EditImageActionButton({super.key});
Expand All @@ -20,12 +20,7 @@ class EditImageActionButton extends ConsumerWidget {
}

final image = Image(image: getFullImageProvider(currentAsset));

context.navigator.push(
MaterialPageRoute(
builder: (context) => DriftEditImagePage(asset: currentAsset, image: image, isEdited: false),
),
);
context.pushRoute(DriftEditImageRoute(asset: currentAsset, image: image, isEdited: false));
}

return BaseActionButton(
Expand Down
Loading