我是 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
设置为您想要的方式
(未测试)
https://stackoverflow.com/questions/50694144/