我是 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.
);
谢谢 .
2 回答
你可以包装
IconTheme
或
Theme
其中iconTheme
按您希望的方式设置(未测试)
要更改子图标的颜色,您必须在Icon()小部件中设置颜色 .
在这里,我分享了我设置了红色的代码片段 .