简体   繁体   English

在 flutter 中添加抽屉时如何自动显示菜单按钮

[英]How to automatically show menu button when adding a drawer in flutter

I've added Drawer to my flutter application, but there is no menu button showing in the app bar to be responsible for opening it.我已将Drawer添加到我的flutter应用程序中,但应用程序栏中没有显示菜单按钮来负责打开它。 I know I can do it programmatically but in the official documentation, it says it should be added automatically, but it is not showing for me我知道我可以通过编程方式做到这一点,但在官方文档中,它说它应该自动添加,但它没有显示给我

here is my code:这是我的代码:

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.deepOrangeAccent,
        automaticallyImplyLeading: false,
      ),
      drawer: Drawer(),
    );
  }

Just comment following line will solve your issue.只需评论以下行即可解决您的问题。

 Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.deepOrangeAccent,
     //   automaticallyImplyLeading: false,
      ),
      drawer: Drawer(),
    );
  }

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

相关问题 查看布局时如何在android中自动显示菜单项(无需单击菜单按钮)? - How to show menu items automatically in android (without clicking menu button) when the layout is viewed.? Android导航抽屉未添加ActionBar菜单按钮 - Android Navigation Drawer not adding ActionBar menu button 在物理菜单按钮上显示导航抽屉 - show navigation drawer on physical menu button 如何在 flutter 中禁用抽屉按钮 - How to disable drawer button in flutter 如何在导航抽屉中添加两个按钮,并在每个按钮上显示不同的菜单项 - How to add two Button in Navigation Drawer and on each Button show Different Menu Items 如何显示带有导航抽屉菜单项的指示器 - How to show an indicator with a navigation drawer menu item 如何禁用导航抽屉菜单按钮? - How to disable navigation drawer menu button? 如何将抽屉连接到flutter中的动画图标按钮? - How to connect drawer to animated icon button in flutter? 固定顶部标题徽标并且滚动菜单项并显示在类别标题中时,如何创建左侧导航抽屉? - How to create left navigation drawer when top header logo is fixed and menu item is scrolling and show in category title? 菜单抽屉在从左向右滑动以显示它时不起作用 - Menu Drawer is not working when swipe left to right to show it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM