info: handle back button to image page

This commit is contained in:
Thibault Deckers 2019-08-31 18:35:32 +09:00
parent 3ba9e5f5e6
commit 714cea3cd2

View file

@ -30,13 +30,7 @@ class FullscreenPage extends AnimatedWidget {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () {
Screen.keepOn(false);
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
return Future.value(true);
},
child: Scaffold(
return Scaffold(
backgroundColor: Colors.black,
body: FullscreenBody(
collection: collection,
@ -71,7 +65,6 @@ class FullscreenPage extends AnimatedWidget {
// ],
// ),
// ),
),
);
}
}
@ -145,7 +138,17 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
@override
Widget build(BuildContext context) {
final entry = entries[_currentHorizontalPage];
return Stack(
return WillPopScope(
onWillPop: () {
if (_currentVerticalPage == 1) {
goToVerticalPage(0);
return Future.value(false);
}
Screen.keepOn(false);
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
return Future.value(true);
},
child: Stack(
children: [
PageView(
scrollDirection: Axis.vertical,
@ -192,6 +195,7 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
)
]
],
),
);
}