AppBar的foregroundColor属性不起作用

Scaffold(
  appBar: AppBar(
    foregroundColor: Colors.orange, // Has no impact
    leading: Icon(Icons.call),
    title: Text('AppBar'),
  ),
)

从文档:

foregroundColor:应用栏中文本和图标的默认颜色。

但是我的应用栏中的文本和图标似乎都没有橙色。

回答

您需要设置backwardsCompatibilityfalseforegroundColor属性工作。这是一个新的属性,目前true是默认的,一旦不再有重大更改,它就会被false默认设置。

AppBar(
  foregroundColor: Colors.orange,
  backwardsCompatibility: false,
  title: Text('AppBar'),
)


以上是AppBar的foregroundColor属性不起作用的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>