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