【发布时间】:2021-08-21 02:55:43
【问题描述】:
我有一个与新的 ElevatedButtonThemeData 小部件相关的问题,基本上我想为我的应用程序中的所有 ElevatedButtons 设置背景颜色,我正在努力尝试通过以下方式在 ThemeData 定义中设置它:
theme: ThemeData(
...
elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle(backgroundColor: Colors.red)), // Here Im having the error
...
),
),
错误:
参数类型“MaterialColor”不能分配给参数类型“MaterialStateProperty
?'.dartargument_type_not_assignable)
【问题讨论】: