问题
I have the following drawer. it works as it should as long as i only want to hop between the widgets of my main drawer items.
Navigation with drawer
but inside those widgets i want to route to a new one, with a button click for example, while the drawer stays in my corner. So basically is there any way to reproduce a sticky android drawer in flutter ?
回答1:
Drawer
is a Scaffold
property.
So when you go to another page you will normally have another Scaffold
widget with its own Drawer
and the previous one will be disposed.
In the new page you need to create and display the Drawer
for this Scaffold
but you can't keep the previous one in the corner.
回答2:
Since the two widgets are independent of each other
, you cannot
use the same exact Drawer
in the second widget.
Either you can create the exact copy of that Drawer
in second one and open it on initState
method or if possible
instead of switching to the second, you can make the second widget
as a subview
inside firstWidget
.
来源:https://stackoverflow.com/questions/50840851/route-to-another-widget-while-drawer-stays-on-the-appbar