flutter 如何通过代码打开drawer

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

找了很多方法,但是not working

最终找到了

class _TestState extends State {
  @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(),
                ),
        ),
      ),
    );
  }
}

你可能感兴趣的:(flutter)