diff --git a/lib/widgets/fullscreen/fullscreen_body.dart b/lib/widgets/fullscreen/fullscreen_body.dart index bd3c980c3..6df0df5a0 100644 --- a/lib/widgets/fullscreen/fullscreen_body.dart +++ b/lib/widgets/fullscreen/fullscreen_body.dart @@ -2,9 +2,11 @@ import 'dart:io'; import 'dart:math'; import 'package:aves/model/collection_lens.dart'; +import 'package:aves/model/filters/filters.dart'; import 'package:aves/model/image_entry.dart'; import 'package:aves/utils/change_notifier.dart'; import 'package:aves/utils/constants.dart'; +import 'package:aves/widgets/album/collection_page.dart'; import 'package:aves/widgets/common/image_providers/thumbnail_provider.dart'; import 'package:aves/widgets/common/image_providers/uri_image_provider.dart'; import 'package:aves/widgets/fullscreen/fullscreen_action_delegate.dart'; @@ -207,22 +209,28 @@ class FullscreenBodyState extends State with SingleTickerProvide _onLeave(); return SynchronousFuture(true); }, - child: Stack( - children: [ - FullscreenVerticalPageView( - collection: collection, - entry: _entry, - videoControllers: _videoControllers, - verticalPager: _verticalPager, - horizontalPager: _horizontalPager, - onVerticalPageChanged: _onVerticalPageChanged, - onHorizontalPageChanged: _onHorizontalPageChanged, - onImageTap: () => _overlayVisible.value = !_overlayVisible.value, - onImagePageRequested: () => _goToVerticalPage(imagePage), - ), - topOverlay, - bottomOverlay, - ], + child: NotificationListener( + onNotification: (notification) { + if (notification is FilterNotification) _goToCollection(notification.filter); + return false; + }, + child: Stack( + children: [ + FullscreenVerticalPageView( + collection: collection, + entry: _entry, + videoControllers: _videoControllers, + verticalPager: _verticalPager, + horizontalPager: _horizontalPager, + onVerticalPageChanged: _onVerticalPageChanged, + onHorizontalPageChanged: _onHorizontalPageChanged, + onImageTap: () => _overlayVisible.value = !_overlayVisible.value, + onImagePageRequested: () => _goToVerticalPage(imagePage), + ), + topOverlay, + bottomOverlay, + ], + ), ), ); } @@ -231,6 +239,17 @@ class FullscreenBodyState extends State with SingleTickerProvide _verticalScrollNotifier.notifyListeners(); } + void _goToCollection(CollectionFilter filter) { + _showSystemUI(); + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute( + builder: (context) => CollectionPage(collection.derive(filter)), + ), + (route) => false, + ); + } + Future _goToVerticalPage(int page) { return _verticalPager.animateToPage( page, @@ -275,9 +294,9 @@ class FullscreenBodyState extends State with SingleTickerProvide // system UI - void _showSystemUI() => SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); + static void _showSystemUI() => SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); - void _hideSystemUI() => SystemChrome.setEnabledSystemUIOverlays([]); + static void _hideSystemUI() => SystemChrome.setEnabledSystemUIOverlays([]); // overlay diff --git a/lib/widgets/fullscreen/info/info_page.dart b/lib/widgets/fullscreen/info/info_page.dart index c425eecb5..189fefa2b 100644 --- a/lib/widgets/fullscreen/info/info_page.dart +++ b/lib/widgets/fullscreen/info/info_page.dart @@ -1,7 +1,6 @@ import 'package:aves/model/collection_lens.dart'; import 'package:aves/model/filters/filters.dart'; import 'package:aves/model/image_entry.dart'; -import 'package:aves/widgets/album/collection_page.dart'; import 'package:aves/widgets/common/aves_filter_chip.dart'; import 'package:aves/widgets/common/data_providers/media_query_data_provider.dart'; import 'package:aves/widgets/fullscreen/info/basic_section.dart'; @@ -155,13 +154,7 @@ class InfoPageState extends State { void _goToCollection(CollectionFilter filter) { if (collection == null) return; - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute( - builder: (context) => CollectionPage(collection.derive(filter)), - ), - (route) => false, - ); + FilterNotification(filter).dispatch(context); } } @@ -228,3 +221,9 @@ class InfoRowGroup extends StatelessWidget { } class BackUpNotification extends Notification {} + +class FilterNotification extends Notification { + final CollectionFilter filter; + + const FilterNotification(this.filter); +}