flutter 如何通过代码打开drawer

https://stackoverflow.com/questions/47435231/change-the-menu-icon-for-drawer-at-appbar

找了很多方法,但是not working

最终找到了

class _TestState extends State<Test> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      drawer: new Drawer(),
      appBar: new AppBar(
        leading: Builder(
            builder: (context) => IconButton(
                  icon: new Icon(Icons.settings),
                  onPressed: () => Scaffold.of(context).openDrawer(),
                ),
        ),
      ),
    );
  }
}
    原文作者:null_null999
    原文地址: https://blog.csdn.net/nimeghbia/article/details/84656594
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞