I am trying to apply a custom buttonStyle inside of ThemeData for my Flutter App.
Everything works fine, but the BorderSide is ignored and is always the default (BorderSide.color = Colors.black
and BorderSide.width = 1.0
)
How can I change the BorderSide inside Theme so it gets red with a radius of 2.0?
outlinedButtonTheme: OutlinedButtonThemeData(
style: ButtonStyle(
shape: MaterialStateProperty.resolveWith((states) {
return RoundedRectangleBorder(
// borderRadius is not ignored and gets applied to OutlinedButton => everything fine
borderRadius: BorderRadius.zero,
// here it gets interesting, the side-parameter is always ignored and defaults to `color: Colors.black` and `width: BorderSide.width = 1.0`
side: BorderSide(color: Colors.red, width: 2.0),
);
}),
),
)
For anyone having the same issue,
OutlinedButtonThemeData
has a ownside
parameter. TheBorderSide
has to be applied there.