Check drawer state when back.

This commit is contained in:
Junyuan Feng
2022-02-08 21:33:14 +08:00
parent 02a8a38a0a
commit 1184841c24
3 changed files with 16 additions and 4 deletions

View File

@@ -32,4 +32,4 @@ class MenuItems {
], ],
); );
} }
} }

View File

@@ -2,9 +2,9 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 94; static const int build = 95;
static const String engine = static const String engine =
"Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 5f105a6ca7 (7 days ago) • 2022-02-01 14:15:42 -0800\nEngine • revision 776efd2034\nTools • Dart 2.16.0 • DevTools 2.9.2\n"; "Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 5f105a6ca7 (7 days ago) • 2022-02-01 14:15:42 -0800\nEngine • revision 776efd2034\nTools • Dart 2.16.0 • DevTools 2.9.2\n";
static const String buildAt = "2022-02-08 21:12:52.441728"; static const String buildAt = "2022-02-08 21:30:51.218738";
static const int modifications = 0; static const int modifications = 3;
} }

View File

@@ -83,6 +83,18 @@ class _MyHomePageState extends State<MyHomePage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
setTransparentNavigationBar(context); setTransparentNavigationBar(context);
super.build(context); super.build(context);
return WillPopScope(
child: _buildMain(context),
onWillPop: () {
if (_advancedDrawerController.value.visible) {
_advancedDrawerController.hideDrawer();
return Future.value(false);
}
return Future.value(true);
});
}
Widget _buildMain(BuildContext context) {
return AdvancedDrawer( return AdvancedDrawer(
controller: _advancedDrawerController, controller: _advancedDrawerController,
animationCurve: Curves.easeInOutCirc, animationCurve: Curves.easeInOutCirc,