简体   繁体   English

Flutter - 删除脚手架中的抽屉图标

[英]Flutter - Remove drawer icon in scaffold

i'm trying to remove the burger drawer icon in flutter, but I don't find any solution.我试图删除 flutter 中的汉堡抽屉图标,但我没有找到任何解决方案。 I don't have an appbar, so I can't hide it changing leading attribute.我没有应用栏,所以我无法隐藏它改变的主要属性。 This is my code:这是我的代码:

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          drawer: Drawer(
            child: Container()
            ),
          body: Container()
        ),
    );
  }

Edit: This is the icon编辑:这是图标在此处输入图像描述

在 App bar 中将 automaticallyImplyLeading 属性设置为 false 并且它不会出现

I just find out what was happening.我只是知道发生了什么。 It was not a Scaffold problem, it happened when I added an AppBar.这不是 Scaffold 问题,是在我添加 AppBar 时发生的。 I didn't have one in the Scaffold, but inside it I have an NestedScrollView where I used and SliverAppBar that created that icon, you can easily hide it by using: leading: Container() inside any appbar我在 Scaffold 中没有一个,但在里面我有一个 NestedScrollView 和创建该图标的 SliverAppBar,您可以使用以下方法轻松隐藏它: leading: Container() inside any appbar

If you are using drawer use this line to hide inside AppBar() widget如果您使用的是抽屉,请使用此行隐藏在 AppBar() 小部件内

  automaticallyImplyLeading: false,

and if you are using end drawer use it如果您使用的是末端抽屉,请使用它

  actions: <Widget>[Container()],

There's no drawer icon in the code above.上面的代码中没有抽屉图标。 I just ran it.我刚跑了。 If you don't want a drawer then you shouldn't supply one.如果你不想要一个抽屉,那么你不应该提供一个。 Just leave it null.把它留空。 See image below for the result your code produces.有关代码生成的结果,请参见下图。 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM