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

问题描述 投票:0回答:1

我已将Drawer添加到我的flutter应用程序中,但应用程序栏中没有菜单按钮显示要打开它。我知道我可以通过编程方式执行此操作,但是在官方文档中,它说应该自动添加,但对我而言未显示

这是我的代码:

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

android ios flutter navigation-drawer
1个回答
1
投票

只需在下一行注释即可解决您的问题。

 Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.deepOrangeAccent,
     //   automaticallyImplyLeading: false,
      ),
      drawer: Drawer(),
    );
  }
© www.soinside.com 2019 - 2024. All rights reserved.