Apply flat button styling globally, ie. dialogs

This commit is contained in:
Hillel Coren 2021-05-02 13:03:00 +03:00
parent d6cd740532
commit 47e3f76bca
1 changed files with 15 additions and 11 deletions

View File

@ -20,17 +20,21 @@ class AppTextButton extends StatelessWidget {
final store = StoreProvider.of<AppState>(context);
final state = store.state;
final ButtonStyle flatButtonStyle = TextButton.styleFrom(
primary: onPressed == null
? null
: color != null
? color
: isInHeader
? state.headerTextColor
: state.prefState.enableDarkMode
? Colors.white
: Colors.black87,
);
Color primaryColor;
if (onPressed == null) {
//
} else if (color != null) {
primaryColor = color;
} else if (isInHeader) {
primaryColor = state.headerTextColor;
} else if (state.prefState.enableDarkMode) {
primaryColor = Colors.white;
} else {
primaryColor = Colors.black87;
}
final ButtonStyle flatButtonStyle =
TextButton.styleFrom(primary: primaryColor);
return TextButton(
style: flatButtonStyle,