RafaelBarbosatec / hidden_drawer_menu

Hidden Drawer Menu is a library for adding a beautiful drawer mode menu feature with perspective animation.
MIT License
352 stars 55 forks source link

How to go back to main page using arrow icon? #29

Open JoeCapo87 opened 4 years ago

JoeCapo87 commented 4 years ago

Hi @RafaelBarbosatec, the use case scenario is similar to the one on the official guide: https://flutter.dev/docs/cookbook/navigation/navigation-basics#interactive-example

If inside Page1 i can navigate to pageX, how can i go back to Page1 using the button in the appbar? The drawer icon should became the back button (arrow icon instead 3 lines icon), but it isn't so. Also i need the appbar on every screen, so I can't use the gestures to navigate back.

EbrahimMosaaed commented 4 years ago

Hi @RafaelBarbosatec, the use case scenario is similar to the one on the official guide: https://flutter.dev/docs/cookbook/navigation/navigation-basics#interactive-example

If inside Page1 i can navigate to pageX, how can i go back to Page1 using the button in the appbar? The drawer icon should became the back button (arrow icon instead 3 lines icon), but it isn't so. Also i need the appbar on every screen, so I can't use the gestures to navigate back.

Hi Did you find any solution ?

SamiraAriaeifar commented 4 years ago

SimpleHiddenDrawer( menu: Menu(), typeOpen: TypeOpen.FROM_RIGHT, // isDraggable: false, initPositionSelected: 2, screenSelectedBuilder: (position, controller) { Widget screenCurrent; switch (position) { case 11: screenCurrent = ScreenLogin(); break; case 12: screenCurrent = ScreenProfile(); break; case 2: screenCurrent = ScreenHome(); break; case 3: screenCurrent = ScreenAddresses(); break; case 4: screenCurrent = ScreenOrders(); break; case 6: screenCurrent = ScreenFavorite(); break; } return Scaffold( backgroundColor: Colors.white, appBar: !(position == 11 || position == 12 || position == 3 || position == 4 || position == 6) ? AppBar( backgroundColor: Colors.grey[100], centerTitle: true, elevation: 0.0, title: Text( '' style: TextStyle( color: Color(0xff008a7d), fontWeight: FontWeight.bold), ), actions: [ GestureDetector( onTap: () async { // Navigator.pushNamed(context, "/scan_barcode"); if (!_isLoading) scan(); }, child: Container( margin: EdgeInsets.only(top:8,left: 8), child: SvgPicture.asset( 'assets/images/ic_barcode.svg', width: 50, color: Color(0xff008a7d), )), ),

              ],

            )
          : null,
      body: screenCurrent,
    );