如何使用主题通用更改AppBar的文本颜色,FAB的图标颜色?
我可以将的背景色设置AppBar为Colors.amber。这将自动将文本颜色设置为黑色。我知道可能会出现可访问性问题,但是无论如何我都希望文本颜色为白色。
我仍然可以从设置文本颜色,AppBar但是我想对其进行通用设置。
这是我用于应用程序的主题。
title: 'Flutter Demo',theme: new ThemeData(
  primarySwatch: Colors.amber,
  textTheme: Theme.of(context).textTheme.apply(
    bodyColor: Colors.white,
    displayColor: Colors.white,
  ),
),
回答:
我认为最简单的方法是调整正在使用的主题的标题颜色:
theme: new ThemeData(  primarySwatch: Colors.grey,
  primaryTextTheme: TextTheme(
    headline6: TextStyle(
      color: Colors.white
    )
  )
)
以上是 如何使用主题通用更改AppBar的文本颜色,FAB的图标颜色? 的全部内容, 来源链接: utcz.com/qa/419383.html

