首页 > 解决方案 > 无靠背的颤振抽屉

问题描述

我想删除抽屉上的后退按钮

Drawer(
              child: ListView(
                padding: EdgeInsets.zero,
                children: <Widget>[ 
                  ListTile(
                    leading: Icon(Icons.home),
                    title: Text ('Home'),
                    onTap: () {
                      Navigator.pop(context);
                      Navigator.push(context,
                          MaterialPageRoute(builder: (context) => HomePage(auth: widget.auth,userId: widget.userId,onSignedOut: this.widget.onSignedOut,)));
                    },
                  ),

                 ListTile(
                   leading: Icon(Icons.exit_to_app),
                    title: Text('Log Out'),
                    onTap: () {
                     _signOut();
                    // Navigator.pop(context);
                     Navigator.of(context).pushReplacement(
                         new MaterialPageRoute(builder: (context) =>RootPage(auth: new Auth())
                     ));
                    },
                  ),
                ],
              ),
        );

我想返回我的登录页面,没有应用栏上的后退按钮

标签: flutter

解决方案


automaticallyImplyLeading: false像这样添加AppBar

Scaffold(
  appBar: AppBar(
    automaticallyImplyLeading: false,
    title: Text("Title"),
  ),
  drawer: Drawer(),
)

推荐阅读