From 2a7482d6d4f49118b709da25f087fa541040fbc4 Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Thu, 2 Apr 2020 10:42:44 +0900 Subject: [PATCH] viewer: swipe down to exit --- lib/widgets/fullscreen/fullscreen_body.dart | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/widgets/fullscreen/fullscreen_body.dart b/lib/widgets/fullscreen/fullscreen_body.dart index 5bc8f8a1a..5a1c7d10f 100644 --- a/lib/widgets/fullscreen/fullscreen_body.dart +++ b/lib/widgets/fullscreen/fullscreen_body.dart @@ -54,7 +54,7 @@ class FullscreenBodyState extends State with SingleTickerProvide List get entries => hasCollection ? collection.sortedEntries : [widget.initialEntry]; - List get pages => hasCollection ? ['transition', 'image', 'info'] : ['image', 'info']; + List get pages => ['transition', 'image', 'info']; int get transitionPage => pages.indexOf('transition'); @@ -131,10 +131,6 @@ class FullscreenBodyState extends State with SingleTickerProvide _goToVerticalPage(imagePage); return SynchronousFuture(false); } - if (!ModalRoute.of(context).canPop) { - // exit app when trying to pop a fullscreen page that is a viewer for a single entry - exit(0); - } _onLeave(); return SynchronousFuture(true); }, @@ -242,9 +238,15 @@ class FullscreenBodyState extends State with SingleTickerProvide setState(() {}); } - // system UI + void _onLeave() { + if (!ModalRoute.of(context).canPop) { + // exit app when trying to pop a fullscreen page that is a viewer for a single entry + exit(0); + } + _showSystemUI(); + } - void _onLeave() => _showSystemUI(); + // system UI void _showSystemUI() => SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); @@ -367,8 +369,7 @@ class _FullscreenVerticalPageViewState extends State final onScaleChanged = (state) => setState(() => _isInitialScale = state == PhotoViewScaleState.initial); final pages = [ // fake page for opacity transition between collection and fullscreen views - if (hasCollection) - const SizedBox(), + const SizedBox(), hasCollection ? MultiImagePage( collection: collection,