我正在使用flutter插件map_view,并且已在代码中集成了该示例(https://pub.dartlang.org/packages/map_view#-example-tab-)。我有一个导航抽屉,其中有一个名为“example”的字段,该链接指向链接的示例页面。在这里按下 map 按钮可打开 map 。打开 map 后,使用“后退”按钮返回带有“ map ”按钮的页面。我想绕过 map 按钮页面,然后回到上一页,即带有导航抽屉的页面。我该如何实现?我是Flutter的新手。
先感谢您!
最佳答案
请按照以下步骤操作:
新MaterialApp(
主页:新的Screen1(),
路线:{
'/ navdrawer':(BuildContext上下文)=> new NavigationDrawerScreeen(),
'/ mapbutton':(BuildContext上下文)=>新的MapButtonScreen(),
'/ map':(BuildContext上下文)=> new MapScreen(),
},
)
Navigator.pushNamed
导航到您的页面。Navigator.pushNamed(context,“mapbutton”);
Navigator.pushNamed(context,“map”);
Navigator.popUntil(上下文,ModalRoute.withName('/ navdrawer'));