【问题标题】:Flutter drawer without back无靠背的颤振抽屉
【发布时间】:2019-10-03 20:21:11
【问题描述】:

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

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


    【解决方案1】:

    像这样将automaticallyImplyLeading: false 添加到AppBar

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

    【讨论】:

      猜你喜欢
      • 2019-10-30
      • 2018-06-05
      • 1970-01-01
      • 2019-05-19
      • 1970-01-01
      • 2022-11-02
      • 2019-11-03
      • 2023-02-13
      • 1970-01-01
      相关资源
      最近更新 更多