I am working on a Flutter
app and need to specify custom ButtonTheme
for each button type, i.e. raised, outlined and flat.
The parameter I found in ThemeData
class is only buttonTheme
, and this has ButtonThemeData
that is defined for all buttons:
static ThemeData darkTheme = ThemeData(
buttonTheme: const ButtonThemeData(
colorScheme: ColorScheme(
primary: Color(Constants.PrimaryColor),
primaryVariant: Color(Constants.PrimaryVariant),
),
textTheme: ButtonTextTheme.normal,
),
)
The question now, how can I define a separate theme for each button type to change, for example, background and text color?
here you can replace RaisedButton with FlatButton or outlinedButton and give a particular theme to all types of buttons. so you can reuse it.
and you can use it like this: