Flutter 其他页面中的颤振抽屉工作不正常

Flutter 其他页面中的颤振抽屉工作不正常,flutter,flutter-navigation,flutter-appbar,flutter-drawer,Flutter,Flutter Navigation,Flutter Appbar,Flutter Drawer,我有一个抽屉类,共3页。这里我的问题是,若我打开抽屉中的任何列表项页面,而在主屏幕中,它的工作正常。如果我转到主屏幕以外的某个页面(比如第2页屏幕),现在如果我打开抽屉中的任何列表项,它会打开屏幕,但问题是,如果我按下后退按钮,它会转到主屏幕而不是第2页屏幕 抽屉类: class CustomDrawer extends StatelessWidget { @override Widget build(BuildContext context) { return Theme(

我有一个抽屉类,共3页。这里我的问题是,若我打开抽屉中的任何列表项页面,而在主屏幕中,它的工作正常。如果我转到主屏幕以外的某个页面(比如第2页屏幕),现在如果我打开抽屉中的任何列表项,它会打开屏幕,但问题是,如果我按下后退按钮,它会转到主屏幕而不是第2页屏幕

抽屉类:

class CustomDrawer extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Theme(
      data: Theme.of(context).copyWith(
        canvasColor: Colors.deepOrangeAccent.withOpacity(0.9), //This will change the drawer background to blue.//other styles
      ),
      child: Drawer(
        child: Column(
          children: <Widget>[
           
            Padding(

              padding: const EdgeInsets.only(left:8.0),
              child: ListView(
                shrinkWrap: true,
                children: <Widget>[
                  ListTile(
                    leading: Icon(Icons.event_note,color: Colors.white),
                    title: Text("Menu",style: TextStyle(color:Colors.white),),
                    onTap: () {
                    Navigator.push (
                          context, MaterialPageRoute(builder(BuildContextcontext)=> Menu()));
                    
                  
                    },
                  ),
                  ListTile(
                    leading: Icon(Icons.person,color: Colors.white),
                    title: Text("My Profile",style: TextStyle(color:Colors.white),),
                    onTap: () {
                      Navigator.push (
                          context, MaterialPageRoute(builder: (BuildContext context) => MyProfile()));

                    },
                  ),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
class CustomDrawer扩展了无状态小部件{
@凌驾
小部件构建(构建上下文){
返回主题(
数据:Theme.of(context).copyWith(
canvasColor:Color.deepOrangeAccent.withOpacity(0.9),//这会将抽屉背景更改为蓝色//其他样式
),
孩子:抽屉(
子:列(
儿童:[
填充物(
填充:仅限常量边集(左:8.0),
子:ListView(
收缩膜:对,
儿童:[
列表砖(
前导:图标(图标。事件注释,颜色:颜色。白色),
标题:文本(“菜单”,样式:TextStyle(颜色:Colors.white),),
onTap:(){
导航器。推(
context,materialpage(builder(BuildContextcontext)=>Menu());
},
),
列表砖(
前导:图标(图标。人物,颜色:颜色。白色),
标题:文本(“我的个人资料”,样式:TextStyle(颜色:Colors.white),),
onTap:(){
导航器。推(
context,materialpage(builder:(BuildContext context)=>MyProfile());
},
),
],
),
)
],
),
),
);
}
}

能否在应用程序的其余部分显示导航?在另一个屏幕中,我使用了Navigator.pushNamed(context,“/MenuScreen”);像这样在屏幕之间导航@nvoigt你能在应用程序的其余部分显示导航吗?在另一个屏幕中,我使用了Navigator.pushNamed(context,“/MenuScreen”);就像在屏幕之间导航一样@nvoigt