diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 90111d4fd..9a3c582c5 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -37,12 +37,13 @@ + tools:targetApi="o"> extentNotifier = ValueNotifier(0); + late final ValueNotifier extentNotifier; late double userPreferredExtent; Size _viewportSize = Size.zero; @@ -24,6 +24,7 @@ class TileExtentController { required this.spacing, required this.horizontalPadding, }) { + extentNotifier = ValueNotifier(extentMin); userPreferredExtent = settings.getTileExtent(settingsRouteKey); settings.addListener(_onSettingsChanged); } diff --git a/lib/widgets/filter_grids/common/action_delegates/album_set.dart b/lib/widgets/filter_grids/common/action_delegates/album_set.dart index a0c5b2e6c..72330a527 100644 --- a/lib/widgets/filter_grids/common/action_delegates/album_set.dart +++ b/lib/widgets/filter_grids/common/action_delegates/album_set.dart @@ -173,6 +173,7 @@ class AlbumChipSetActionDelegate extends ChipSetActionDelegate with final showAction = SnackBarAction( label: context.l10n.showButtonLabel, onPressed: () async { + // assume Album page is still the current page when action is triggered final filter = AlbumFilter(newAlbum, source.getAlbumDisplayName(context, newAlbum)); context.read().trackItem(FilterGridItem(filter, null), highlightItem: filter); }, diff --git a/lib/widgets/viewer/action/entry_action_delegate.dart b/lib/widgets/viewer/action/entry_action_delegate.dart index b2650a91b..aaac98e8d 100644 --- a/lib/widgets/viewer/action/entry_action_delegate.dart +++ b/lib/widgets/viewer/action/entry_action_delegate.dart @@ -258,12 +258,15 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix source.resumeMonitoring(); source.refreshUris(newUris); + final l10n = context.l10n; + final navigator = Navigator.of(context); final showAction = isMainMode && newUris.isNotEmpty ? SnackBarAction( - label: context.l10n.showButtonLabel, + label: l10n.showButtonLabel, onPressed: () { - Navigator.pushAndRemoveUntil( - context, + // `context` may be obsolete if the user navigated away before triggering the action + // so we reused the navigator retrieved before showing the snack bar + navigator.pushAndRemoveUntil( MaterialPageRoute( settings: const RouteSettings(name: CollectionPage.routeName), builder: (context) => CollectionPage( @@ -282,13 +285,13 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix final count = selectionCount - successCount; showFeedback( context, - context.l10n.collectionExportFailureFeedback(count), + l10n.collectionExportFailureFeedback(count), showAction, ); } else { showFeedback( context, - context.l10n.genericSuccessFeedback, + l10n.genericSuccessFeedback, showAction, ); } diff --git a/lib/widgets/viewer/video_action_delegate.dart b/lib/widgets/viewer/video_action_delegate.dart index 0873f0ef0..0fc98c622 100644 --- a/lib/widgets/viewer/video_action_delegate.dart +++ b/lib/widgets/viewer/video_action_delegate.dart @@ -107,16 +107,19 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix ); final success = newFields.isNotEmpty; + final l10n = context.l10n; if (success) { final _collection = collection; + final navigator = Navigator.of(context); final showAction = _collection != null ? SnackBarAction( - label: context.l10n.showButtonLabel, + label: l10n.showButtonLabel, onPressed: () { final source = _collection.source; final newUri = newFields['uri'] as String?; - Navigator.pushAndRemoveUntil( - context, + // `context` may be obsolete if the user navigated away before triggering the action + // so we reused the navigator retrieved before showing the snack bar + navigator.pushAndRemoveUntil( MaterialPageRoute( settings: const RouteSettings(name: CollectionPage.routeName), builder: (context) => CollectionPage( @@ -130,9 +133,9 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix }, ) : null; - showFeedback(context, context.l10n.genericSuccessFeedback, showAction); + showFeedback(context, l10n.genericSuccessFeedback, showAction); } else { - showFeedback(context, context.l10n.genericFailureFeedback); + showFeedback(context, l10n.genericFailureFeedback); } }