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