How to add icon to AppBar in Flutter

前端 未结 1 897
时光说笑
时光说笑 2021-02-12 16:31

If I have an AppBar like this:

How do I add a clickable icon to it like this?

相关标签:
1条回答
  • How to add an icon to the AppBar

    You can add an icon to the AppBar by adding an IconButton widget to the actions list of the AppBar.

    AppBar(
      title: Text('My App'),
      actions: <Widget>[
        IconButton(
          icon: Icon(
            Icons.settings,
            color: Colors.white,
          ),
          onPressed: () {
            // do something
          },
        )
      ],
    ),
    

    See also

    • AppBar Basics documentation
    • How can I have clickable text in the AppBar in Flutter
    0 讨论(0)
提交回复
热议问题