flutter - 如何在 Flutter 中为 AppBar 添加图标

标签 flutter icons flutter-appbar

如果我有这样的 AppBar:



如何像这样添加可点击的图标?

最佳答案


您可以通过向 actions 添加 IconButton 小部件来向 AppBar 添加图标。 AppBar 列表。

AppBar(
  title: Text('My App'),
  actions: <Widget>[
    IconButton(
      icon: Icon(
        Icons.settings,
        color: Colors.white,
      ),
      onPressed: () {
        // do something
      },
    )
  ],
),
也可以看看
  • AppBar Basics documentation
  • How can I have clickable text in the AppBar in Flutter
  • 关于flutter - 如何在 Flutter 中为 AppBar 添加图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57941227/

    相关文章:

    flutter - 如何使用灵活且可扩展的小部件在 flutter 中布局单元格

    html - 如何在搜索引擎结果中隐藏图标字体?

    macos - 如何创建一个完美的OS X托盘图标( Electron )?

    flutter - 如何使 Flutter RaisedButton 处于选中状态

    flutter - 未处理的异常:NoSuchMethodError:在空调用getter 'text'

    r - geom_bar() + 象形图,怎么做?

    flutter - 如何在 flutter 中让 Appbar 的 IconButton 居中

    Flutter .. 如何实现自定义应用栏——使用和再使用

    dart - 如何在 Flutter 中返回 Widget 列表的一部分