viewer: swipe down to exit
This commit is contained in:
parent
50632b5212
commit
2a7482d6d4
1 changed files with 10 additions and 9 deletions
|
@ -54,7 +54,7 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
|
||||||
|
|
||||||
List<ImageEntry> get entries => hasCollection ? collection.sortedEntries : [widget.initialEntry];
|
List<ImageEntry> get entries => hasCollection ? collection.sortedEntries : [widget.initialEntry];
|
||||||
|
|
||||||
List<String> get pages => hasCollection ? ['transition', 'image', 'info'] : ['image', 'info'];
|
List<String> get pages => ['transition', 'image', 'info'];
|
||||||
|
|
||||||
int get transitionPage => pages.indexOf('transition');
|
int get transitionPage => pages.indexOf('transition');
|
||||||
|
|
||||||
|
@ -131,10 +131,6 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
|
||||||
_goToVerticalPage(imagePage);
|
_goToVerticalPage(imagePage);
|
||||||
return SynchronousFuture(false);
|
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();
|
_onLeave();
|
||||||
return SynchronousFuture(true);
|
return SynchronousFuture(true);
|
||||||
},
|
},
|
||||||
|
@ -242,9 +238,15 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
|
||||||
setState(() {});
|
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);
|
void _showSystemUI() => SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
|
||||||
|
|
||||||
|
@ -367,8 +369,7 @@ class _FullscreenVerticalPageViewState extends State<FullscreenVerticalPageView>
|
||||||
final onScaleChanged = (state) => setState(() => _isInitialScale = state == PhotoViewScaleState.initial);
|
final onScaleChanged = (state) => setState(() => _isInitialScale = state == PhotoViewScaleState.initial);
|
||||||
final pages = [
|
final pages = [
|
||||||
// fake page for opacity transition between collection and fullscreen views
|
// fake page for opacity transition between collection and fullscreen views
|
||||||
if (hasCollection)
|
const SizedBox(),
|
||||||
const SizedBox(),
|
|
||||||
hasCollection
|
hasCollection
|
||||||
? MultiImagePage(
|
? MultiImagePage(
|
||||||
collection: collection,
|
collection: collection,
|
||||||
|
|
Loading…
Reference in a new issue