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

@@ -83,6 +83,18 @@ class _MyHomePageState extends State<MyHomePage>
Widget build(BuildContext context) {
setTransparentNavigationBar(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(
controller: _advancedDrawerController,
animationCurve: Curves.easeInOutCirc,