Update flat button

This commit is contained in:
Hillel Coren 2021-04-21 22:09:15 +03:00
parent 4dd1750224
commit 5b762c0955
1 changed files with 20 additions and 18 deletions

View File

@ -20,25 +20,27 @@ class AppTextButton extends StatelessWidget {
final store = StoreProvider.of<AppState>(context);
final state = store.state;
return TextButton(
onPressed: onPressed,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Text(
label,
style: TextStyle(
color: onPressed == null
? null
: color != null
? color
: isInHeader
? state.headerTextColor
: state.prefState.enableDarkMode
? Colors.white
: Colors.black,
),
),
final ButtonStyle flatButtonStyle = TextButton.styleFrom(
primary: onPressed == null
? null
: color != null
? color
: isInHeader
? state.headerTextColor
: state.prefState.enableDarkMode
? Colors.white
: Colors.black87,
minimumSize: Size(88, 36),
padding: EdgeInsets.symmetric(horizontal: 16),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
),
);
return TextButton(
style: flatButtonStyle,
onPressed: onPressed,
child: Text(label),
);
}
}