简体   繁体   English

Flutter ThemeData 中 FAB 图标的颜色属性

[英]Color property for FAB icon in Flutter ThemeData

Question:问题:

What is the property(?) for changing the default color of the icons in floating action buttons in flutter?更改 flutter 中浮动操作按钮中图标的默认颜色的属性(?)是什么? I know accentColor changes the background color of the FAB.我知道accentColor改变FAB 的背景颜色。 Is there even one or does it have to be declared in the regular code?甚至有一个还是必须在常规代码中声明? For example, if I wanted to change the icon color of the FAB pictured below to white or pink or whatever.例如,如果我想将下图所示的 FAB 的图标颜色更改为白色或粉红色等。

扑

在此处输入图像描述

在此处输入图像描述

You can change the icon color of the FAB by passing Color to the color property of Icon.您可以通过将 Color 传递给 Icon 的color属性来更改 FAB 的图标颜色。

floatingActionButton: FloatingActionButton(
  backgroundColor: Colors.red,
  onPressed: () {},
  child: Icon(Icons.add, color: Colors.white)
  ),
),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM