Flutter navigation drawer hamburger icon color change

前端 未结 3 1733
无人及你
无人及你 2021-02-06 22:02

Hamburger icon color of navigation drawer is not changing. Its black by default. I want to change the this icon color in flutter, I am stuck, help me to change this icon color.

相关标签:
3条回答
  • 2021-02-06 22:21

    You can also use following in Theme's data property

    Theme(
      data: ThemeData(primaryIconTheme: IconThemeData(color: Colors.red)), // use this
      child: Scaffold(),
    )
    

    Or

    appBar: AppBar(
      leading: IconButton(
        icon: Icon(Icons.menu, color: Colors.red), // set your color here
        onPressed: () {},
      ),
    ),
    
    0 讨论(0)
  • 2021-02-06 22:29

    Add iconTheme to your AppBar

    @override
    Widget build(BuildContext context) {
      return Scaffold(
        drawer: Drawer(),
        appBar: AppBar(
          title: Text("Navigation Drawer"),
          iconTheme: IconThemeData(color: Colors.green),
        ),
      );
    }
    

    You can also check other solutions here.

    0 讨论(0)
  • 2021-02-06 22:31

    To change color of your icon use this

      @override
      Widget build(BuildContext context) {
       return new MaterialApp(
       home: new Scaffold(
        appBar: AppBar(title: new Text('List view example'),
          leading: new Icon(Icons.menu,color: Colors.green,),
       ),
    ),
     );
     }
    

    Icon(Icons.menu,color: Colors.green,) define color inside Icon

    0 讨论(0)
提交回复
热议问题