在使用Button theme时,应该使用OutlinedButton或TextButton代替RaisedButton,以便在与ElevatedButton一起使用时正确渲染样式。示例代码如下:
Theme(
data: ThemeData(
buttonTheme: ButtonThemeData(
textTheme: ButtonTextTheme.primary,
// 使用OutlinedButton或TextButton代替RaisedButton
// raisedButtonTheme: ElevatedButtonThemeData(...),
// 可以使用elevatedButtonTheme来定制ElevatedButton的主题
// elevatedButtonTheme: ElevatedButtonThemeData(...)
)
),
child: Column(
children: [
OutlinedButton(
onPressed: () {},
child: Text('OutlinedButton'),
),
ElevatedButton(
onPressed: () {},
child: Text('ElevatedButton'),
),
TextButton(
onPressed: () {},
child: Text('TextButton'),
),
],
),
)