gpt4 book ai didi

dart - Flutter 改变 FloatingActionButton 的子图标颜色

转载 作者:IT老高 更新时间:2023-10-28 12:36:32 26 4
gpt4 key购买 nike

我是 Flutter 的新手,正在尝试更改 FloatingActionButton 的子图标颜色。子图标颜色默认为白色。

我怎样才能改变它??

下面是我处理过的代码。

floatingActionButton: new FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: new Icon(Icons.add),
backgroundColor: Colors.yellow,

), // This trailing comma makes auto-formatting nicer for build methods.
);

谢谢。

最佳答案

你可以用 IconTheme

child: new IconTheme(
data: new IconThemeData(
color: Colors.yellow),
child: new Icon(Icons.add),
),

Theme,其中 iconTheme 设置为您想要的方式

(未测试)

关于dart - Flutter 改变 FloatingActionButton 的子图标颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50694144/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com