I am trying to change the shape of all my buttons with a default shape specified in the App's theme but the button stays the same:
void main() {
runApp(MaterialApp(
home: ...,
theme: ThemeData(
buttonTheme: ButtonThemeData(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(112.0),
side: BorderSide(width: 11110)
),
....
)),
));
}
class Home extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
body: FilledButton()
);
}
}
I have used the buttonTheme
property of ThemeData()
as I would like that shape to be applied to all different-type buttons. Should have I used FilledButtonThemeData instead?
p.s. I am using flutter 3.27
Try using filledButtonTheme
for FilledButton
with realistic values
theme: ThemeData(
filledButtonTheme: FilledButtonThemeData(
style: ButtonStyle(
shape: WidgetStatePropertyAll(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(2.0),
side: BorderSide(width: 12)),
),
),
),
),