首页 > 解决方案 > 如何通过主题更改 Flutter 中抽屉的标准汉堡菜单图标的大小

问题描述

在创建主题时:

appBarTheme: new AppBarTheme(
          iconTheme: base.appBarTheme.iconTheme.copyWith(size: 100, color: Colors.red), 
          //Color is working but size having no effect*
        ),

标签: flutterappbar

解决方案


更改汉堡菜单的最简单方法是leadingAppBar更改小部件

final _scaffoldKey = new GlobalKey<ScaffoldState>();

@override
Widget build(BuildContext context) {
    return Scaffold(
      key: _scaffoldKey,
      appBar: AppBar(
        leading: IconButton(
          icon: Icon(Icons.menu, size: 40), // change this size and style
          onPressed: () => _scaffoldKey.currentState.openDrawer(),
        ),
        title: Text('Home Screen'),
      ),
      body: Container(),
      drawer: Container(
        width: 300,
        color: Colors.white,
      ),
   );
}

此更改将创建这个巨大的汉堡菜单:

汉堡菜单


推荐阅读