'Flutter: Get.back() function triggers ZoomDrawer

I have a very simple Appbar with Get.back()function and ZoomDrawer. and ZoomDrawer is being opened every time i tap back button. and i have know idea why.. could this be bug of either plugins?

AppBar(
      elevation: 0.0,
      leading: IconButton(
        icon: Icon(Icons.arrow_back),
        onPressed: () => Get.back()
        ,
      ),
      iconTheme: IconThemeData(
        color: Colors.black, //change your color here
      ),
      backgroundColor: Colors.white,
    );
  }
class SomeScreen extends GetView<MyDrawerController> {
  @override
  Widget build(BuildContext context) {
    Get.put<MyDrawerController>(MyDrawerController());
    return GetBuilder<MyDrawerController>(
        builder: (_) => ZoomDrawer(
          controller: _.zoomDrawerController,
          menuScreen: Drawer(),
          mainScreen: AnotherScreen(),
          borderRadius: 24.0,
          showShadow: true,
          angle: -12.0,
          drawerShadowsBackgroundColor: Colors.grey,
          slideWidth: MediaQuery.of(context).size.width,
        ));
  }
}


Solution 1:[1]

Wrap your screen by WillPopScope. Inside onWillPop add the code that open your drawer. This widget will call onWillPop everytime you pop a screen, return a bool in onWillPop that allow pop action continue or not.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1