我一直在努力修改FlutterFire UI中的重音颜色。
也就是说,我想把这里的蓝色强调色改为不同的材质颜色,比如紫色。我把应用主题弄得一团糟,但无济于事,因为到目前为止,ThemeData参数似乎都没有影响这种颜色。我想知道这是否可能?谢谢!
重音颜色已被弃用,所以现在你可以使用Colorscheme代替,像这样
MaterialApp(
theme: ThemeData(
primarySwatch: Colors.orange,
colorScheme: ColorScheme.fromSwatch(accentColor: Colors.green),
),
home: NextScreen(),
);
你可以在主题数据
theme: ThemeData(
outlinedButtonTheme: OutlinedButtonThemeData(
style: ButtonStyle(
padding: MaterialStateProperty.all<EdgeInsets>(
const EdgeInsets.all(24),
),
backgroundColor: MaterialStateProperty.all<Color>(Colors.purple),
foregroundColor: MaterialStateProperty.all<Color>(Colors.white),
),
),
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
foregroundColor:
MaterialStateProperty.all<Color>(Colors.purple)
)
)
),
我最终找到了我自己问题的答案。原来主题是配色方案属性的一部分,我最后定义了以下内容:
colorScheme: ColorScheme.fromSwatch().copyWith(
primary: Colors.deepPurpleAccent
)
这将它们全部设置为deepPurpleAccent!