【问题标题】:Flutter drawer, app bar arrow showing after pulling drawer颤振抽屉,拉抽屉后显示应用栏箭头
【发布时间】:2019-09-05 18:28:12
【问题描述】:

我使用 endDrawer 将抽屉添加到我的项目中,以便将其放置在右侧。当我拉抽屉时,应用栏箭头显示并将其他应用栏内容推到右侧。

已经搜索了一些线程。我使用 Navigator.pushReplacement(...) 进入仪表板。尝试将仪表板也设为主页,因为我认为这是导航的东西,但无济于事 !

endDrawer: Drawer(
        child: ListView(
          padding: EdgeInsets.zero,
          children: <Widget>[
            Container(
              height: 300,
              child: DrawerHeader(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: Image.asset(
                        "assets/avatar.png",
                        width: 90,
                      ),
                    ),
                    Padding(
                      padding: const EdgeInsets.all(5.0),
                      child: Text("Sample Name",
                          style: TextStyle(
                              fontSize: 20,
                              fontWeight: FontWeight.bold,
                              color: Colors.white)),
                    ),
                    Text("sample@mail.com",
                        style: TextStyle(fontSize: 16, color: Colors.white)),

                    // Text()
                  ],
                ),
                decoration: BoxDecoration(
                  color: Colors.blueAccent,
                ),
              ),
            ),
            ListTile(
              leading: Icon(Icons.info),
              title: Text('About'),
              onTap: () {
                // Update the state of the app
                // ...
                // Then close the drawer
                Navigator.pop(context);
              },
            ),
            ListTile(
              leading: Icon(Icons.lock),
              title: Text('Privacy Policy'),
              onTap: () {
                // Update the state of the app
                // ...
                // Then close the drawer
                Navigator.pop(context);
              },
            ),
          ],
        ),
      ),

我需要移除应用栏上显示的箭头

【问题讨论】:

  • 您的代码格式错误,请调整以便我们提供帮助。并提供有助于我们发现问题的情况图像。谢谢
  • 将应用栏中的automaticallyImplyLeading设置为false
  • 这解决了我的问题 anmol.majhail。非常感谢

标签: flutter dart navigation drawer appbar


【解决方案1】:

在你的 AppBar 中插入这个

AppBar (
    automaticallyImplyLeading: false,
    ...
)

【讨论】:

    猜你喜欢
    • 2019-12-05
    • 1970-01-01
    • 2019-05-19
    • 2020-03-23
    • 2023-02-13
    • 1970-01-01
    • 2019-10-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多