我正在使用flutter插件map_view,并且在我的代码中集成了这个示例( https://pub.dartlang.org/packages/map_view#-example-tab- )。我有一个导航抽屉,其中有一个名为" example“的字段,它指向链接的示例页面。在这里,按下地图按钮将打开地图。当地图打开时,使用后退按钮,我们返回到带有地图按钮的页面。我想绕过地图按钮页面,返回到上一页,即带有导航抽屉的页面。我如何才能做到这一点?我是第一次接触Flutter。
提前谢谢你!
发布于 2018-08-14 06:24:07
请按照以下步骤操作:
新建MaterialApp( home: new Screen1(),routes:{ '/navdrawer':(BuildContext context) => new NavigationDrawerScreeen(),'/mapbutton‘:(BuildContext context) => new MapButtonScreen(),'/map’:(BuildContext context) => new MapScreen(),},)
Navigator.pushNamed导航到您的页面。Navigator.pushNamed(context,"mapbutton");Navigator.pushNamed(context,“map”);
context(上下文,ModalRoute.withName('/navdrawer'));,Navigator.popUntil
https://stackoverflow.com/questions/51825150
复制相似问题