我尝试使用ButtonStyle,但是由于某些原因,它要求提供MaterialStateProperty:
outlinedButtonTheme: OutlinedButtonThemeData(
style: ButtonStyle(backgroundColor: ... )
),
答案 0 :(得分:0)
从1.20版本开始,您可以按以下方式设置概述的按钮主题。请参考下面的代码段
return MaterialApp(
home: Home(),
theme: ThemeData.from(
colorScheme: ColorScheme.light(),
).copyWith(
outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom(
primary: Colors.purple,
backgroundColor: Colors.green,
),
),
),
);