diff --git a/lib/widgets/collection/search/search_delegate.dart b/lib/widgets/collection/search/search_delegate.dart index cbda818d6..832bc0608 100644 --- a/lib/widgets/collection/search/search_delegate.dart +++ b/lib/widgets/collection/search/search_delegate.dart @@ -179,7 +179,7 @@ class ImageSearchDelegate { void _goBack(BuildContext context) { _clean(); - Navigator.of(context).pop(); + Navigator.pop(context); } void _goToCollectionPage(BuildContext context, CollectionFilter filter) { diff --git a/lib/widgets/fullscreen/fullscreen_body.dart b/lib/widgets/fullscreen/fullscreen_body.dart index 6e51042f0..6ee3f563f 100644 --- a/lib/widgets/fullscreen/fullscreen_body.dart +++ b/lib/widgets/fullscreen/fullscreen_body.dart @@ -314,7 +314,7 @@ class FullscreenBodyState extends State with SingleTickerProvide void _updateEntry() { if (_currentHorizontalPage != null && entries.isNotEmpty && _currentHorizontalPage >= entries.length) { - // as of Flutter v1.20.2, `PageView` does not call `onPageChanged` when the last page is deleted + // as of Flutter v1.22.2, `PageView` does not call `onPageChanged` when the last page is deleted // so we manually track the page change, and let the entry update follow _onHorizontalPageChanged(entries.length - 1); return; @@ -462,7 +462,7 @@ class _FullscreenVerticalPageViewState extends State void _registerWidget(FullscreenVerticalPageView widget) { widget.verticalPager.addListener(_onVerticalPageControllerChanged); widget.entryNotifier.addListener(_onEntryChanged); - _onEntryChanged(); + if (_oldEntry != entry) _onEntryChanged(); } void _unregisterWidget(FullscreenVerticalPageView widget) { @@ -529,12 +529,17 @@ class _FullscreenVerticalPageViewState extends State // when the entry changed (e.g. by scrolling through the PageView, or if the entry got deleted) void _onEntryChanged() { _oldEntry?.imageChangeNotifier?.removeListener(_onImageChanged); - entry?.imageChangeNotifier?.addListener(_onImageChanged); _oldEntry = entry; - // make sure to locate the entry, - // so that we can display the address instead of coordinates - // even when background locating has not reached this entry yet - entry?.locate(); + + if (entry != null) { + entry.imageChangeNotifier.addListener(_onImageChanged); + // make sure to locate the entry, + // so that we can display the address instead of coordinates + // even when background locating has not reached this entry yet + entry.locate(); + } else { + Navigator.pop(context); + } } // when the entry image itself changed (e.g. after rotation)