Route to another widget while Drawer stays on the appbar

你说的曾经没有我的故事 提交于 2019-12-25 03:15:28

问题


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 Drawerand 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!