-1

I have a list of Screens in a custom drawer.

Screen 1, Screen 2, Screen 3

What is the proper way of navigating from Screen 1 to Screen 2 on push of a button. Currently, I am losing the hamburger (the drawer button) option when I push or push replace.

The code I have was not written by me and I do not have access to the person who wrote the code.

Any thoughts?

Ganesh
  • 1
  • 1

1 Answers1

0

Just use the standard navigation:

TextButton(
  onPressed: (){
    Navigator.push(context, MaterialPageRoute(builder: (context) => Screen2()));
  }
  child: 
    //child goes here
)
  • The problem is that I am losing the drawer menu. Should I include drawer menu in every screen within Scaffold? – Ganesh May 01 '22 at 20:23
  • @Ganesh no it's not necessary, some devs put the drawer in the home page only, and you can push and pop screens from the drawer or by any other actions, e.g. button click, swipe... – Abdallah Abdel Aziz May 01 '22 at 23:34