refactor: text themes using same dialogBackgroundColor

This commit is contained in:
Rafael Saes 2023-07-03 09:37:29 -03:00
parent ec1d2518bf
commit 8e7646f594
9 changed files with 13 additions and 43 deletions

View file

@ -20,7 +20,7 @@ class AccountTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final color = isCurrent final color = isCurrent
? Theme.of(context).textTheme!.titleSmall!.decorationColor! ? Theme.of(context).dialogBackgroundColor
: Theme.of(context).textTheme!.displayLarge!.decorationColor!; : Theme.of(context).textTheme!.displayLarge!.decorationColor!;
final textColor = isCurrent final textColor = isCurrent
? Theme.of(context).primaryColor ? Theme.of(context).primaryColor

View file

@ -66,7 +66,7 @@ class ChooseYatAddressButtonsState extends State<ChooseYatAddressButtons> {
Container( Container(
width: 300, width: 300,
height: 158, height: 158,
color: Theme.of(context).accentTextTheme!.bodyMedium!.backgroundColor!, color: Theme.of(context).dialogBackgroundColor,
child: ListView.separated( child: ListView.separated(
controller: controller, controller: controller,
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),

View file

@ -55,7 +55,7 @@ class PopUpCancellableAlertDialog extends StatelessWidget {
child: Container( child: Container(
width: 340, width: 340,
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
color: Theme.of(context).accentTextTheme.titleLarge!.decorationColor!, color: Theme.of(context).dialogBackgroundColor,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[

View file

@ -31,10 +31,7 @@ class AlertWithOneAction extends BaseAlertDialog {
width: 300, width: 300,
height: 52, height: 52,
padding: EdgeInsets.only(left: 12, right: 12), padding: EdgeInsets.only(left: 12, right: 12),
color: Theme.of(context) color: Theme.of(context).dialogBackgroundColor,
.accentTextTheme!
.bodyMedium!
.backgroundColor!,
child: ButtonTheme( child: ButtonTheme(
minWidth: double.infinity, minWidth: double.infinity,
child: TextButton( child: TextButton(

View file

@ -57,10 +57,7 @@ class BaseAlertDialog extends StatelessWidget {
onPressed: actionLeft, onPressed: actionLeft,
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: leftActionButtonColor ?? backgroundColor: leftActionButtonColor ??
Theme.of(context) Theme.of(context).dialogBackgroundColor,
.accentTextTheme!
.bodyLarge!
.decorationColor!,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.zero))), borderRadius: BorderRadius.all(Radius.zero))),
child: Text( child: Text(
@ -85,10 +82,7 @@ class BaseAlertDialog extends StatelessWidget {
onPressed: actionRight, onPressed: actionRight,
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: rightActionButtonColor ?? backgroundColor: rightActionButtonColor ??
Theme.of(context) Theme.of(context).dialogBackgroundColor,
.accentTextTheme!
.bodyMedium!
.backgroundColor!,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.zero))), borderRadius: BorderRadius.all(Radius.zero))),
child: Text( child: Text(
@ -125,10 +119,7 @@ class BaseAlertDialog extends StatelessWidget {
borderRadius: BorderRadius.all(Radius.circular(30)), borderRadius: BorderRadius.all(Radius.circular(30)),
child: Container( child: Container(
width: 300, width: 300,
color: Theme.of(context) color: Theme.of(context).dialogBackgroundColor,
.accentTextTheme!
.titleLarge!
.decorationColor!,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[

View file

@ -84,11 +84,6 @@ class BrightTheme extends LightTheme {
decorationColor: decorationColor:
Colors.white // background of tiles (account list) Colors.white // background of tiles (account list)
), ),
// subtitle -> titleSmall
titleSmall: TextStyle(
decorationColor:
Colors.white // background of current tile (account list)
),
// body -> bodyMedium // body -> bodyMedium
bodyMedium: TextStyle( bodyMedium: TextStyle(
color: Palette.moderatePurpleBlue, // scrollbar thumb color: Palette.moderatePurpleBlue, // scrollbar thumb
@ -193,7 +188,6 @@ class BrightTheme extends LightTheme {
// title -> titleLarge // title -> titleLarge
titleLarge: TextStyle( titleLarge: TextStyle(
backgroundColor: Palette.periwinkleCraiola, // picker divider backgroundColor: Palette.periwinkleCraiola, // picker divider
decorationColor: Colors.white // dialog background
), ),
bodySmall: TextStyle( bodySmall: TextStyle(
backgroundColor: Palette.moderateLavender, // button background (confirm exchange) backgroundColor: Palette.moderateLavender, // button background (confirm exchange)
@ -260,11 +254,9 @@ class BrightTheme extends LightTheme {
bodyMedium: TextStyle( bodyMedium: TextStyle(
color: Palette.darkGray, // indicators (PIN code) color: Palette.darkGray, // indicators (PIN code)
decorationColor: Palette.darkGray, // switch (PIN code) decorationColor: Palette.darkGray, // switch (PIN code)
backgroundColor: Colors.white // alert right button
), ),
// body2 -> bodyLarge // body2 -> bodyLarge
bodyLarge: TextStyle( bodyLarge: TextStyle(
decorationColor: Colors.white, // alert left button,
backgroundColor: Palette.dullGray // keyboard bar color backgroundColor: Palette.dullGray // keyboard bar color
) )
)); ));

View file

@ -20,6 +20,8 @@ class DarkTheme extends ThemeBase {
Color get primaryTextColor => Colors.white; Color get primaryTextColor => Colors.white;
@override @override
Color get containerColor => PaletteDark.nightBlue; Color get containerColor => PaletteDark.nightBlue;
@override
Color get dialogBackgroundColor => PaletteDark.darkNightBlue;
@override @override
ThemeData get themeData => super.themeData.copyWith( ThemeData get themeData => super.themeData.copyWith(
@ -84,11 +86,6 @@ class DarkTheme extends ThemeBase {
decorationColor: PaletteDark decorationColor: PaletteDark
.darkOceanBlue // background of tiles (account list) .darkOceanBlue // background of tiles (account list)
), ),
// subtitle -> titleSmall
titleSmall: TextStyle(
decorationColor: PaletteDark
.darkNightBlue // background of current tile (account list)
),
// body1 -> bodyMedium // body1 -> bodyMedium
bodyMedium: TextStyle( bodyMedium: TextStyle(
color: PaletteDark.wildBlueGrey, // scrollbar thumb color: PaletteDark.wildBlueGrey, // scrollbar thumb
@ -196,7 +193,6 @@ class DarkTheme extends ThemeBase {
// title -> titleLarge // title -> titleLarge
titleLarge: TextStyle( titleLarge: TextStyle(
backgroundColor: PaletteDark.dividerColor, // picker divider backgroundColor: PaletteDark.dividerColor, // picker divider
decorationColor: PaletteDark.darkNightBlue // dialog background
), ),
bodySmall: TextStyle( bodySmall: TextStyle(
backgroundColor: PaletteDark.deepVioletBlue, // button background (confirm exchange) backgroundColor: PaletteDark.deepVioletBlue, // button background (confirm exchange)
@ -269,11 +265,9 @@ class DarkTheme extends ThemeBase {
bodyMedium: TextStyle( bodyMedium: TextStyle(
color: PaletteDark.indicatorVioletBlue, // indicators (PIN code) color: PaletteDark.indicatorVioletBlue, // indicators (PIN code)
decorationColor: PaletteDark.lightPurpleBlue, // switch (PIN code) decorationColor: PaletteDark.lightPurpleBlue, // switch (PIN code)
backgroundColor: PaletteDark.darkNightBlue // alert right button
), ),
// body2 -> bodyLarge // body2 -> bodyLarge
bodyLarge: TextStyle( bodyLarge: TextStyle(
decorationColor: PaletteDark.darkNightBlue, // alert left button
backgroundColor: PaletteDark.granite // keyboard bar color backgroundColor: PaletteDark.granite // keyboard bar color
), ),
), ),

View file

@ -20,6 +20,8 @@ class LightTheme extends ThemeBase {
Color get primaryTextColor => Palette.darkBlueCraiola; Color get primaryTextColor => Palette.darkBlueCraiola;
@override @override
Color get containerColor => Palette.blueAlice; Color get containerColor => Palette.blueAlice;
@override
Color get dialogBackgroundColor => Colors.white;
@override @override
ThemeData get themeData => super.themeData.copyWith( ThemeData get themeData => super.themeData.copyWith(
@ -84,11 +86,6 @@ class LightTheme extends ThemeBase {
decorationColor: decorationColor:
Colors.white // background of tiles (account list) Colors.white // background of tiles (account list)
), ),
// subtitle -> titleSmall
titleSmall: TextStyle(
decorationColor:
Colors.white // background of current tile (account list)
),
// body -> bodyMedium // body -> bodyMedium
bodyMedium: TextStyle( bodyMedium: TextStyle(
color: Palette.moderatePurpleBlue, // scrollbar thumb color: Palette.moderatePurpleBlue, // scrollbar thumb
@ -194,7 +191,6 @@ class LightTheme extends ThemeBase {
// title -> headlititleLargene6 // title -> headlititleLargene6
titleLarge: TextStyle( titleLarge: TextStyle(
backgroundColor: Palette.periwinkleCraiola, // picker divider backgroundColor: Palette.periwinkleCraiola, // picker divider
decorationColor: Colors.white // dialog background
), ),
bodySmall: TextStyle( bodySmall: TextStyle(
backgroundColor: Palette.blueAlice, // button background (confirm exchange) backgroundColor: Palette.blueAlice, // button background (confirm exchange)
@ -261,11 +257,9 @@ class LightTheme extends ThemeBase {
bodyMedium: TextStyle( bodyMedium: TextStyle(
color: Palette.darkGray, // indicators (PIN code) color: Palette.darkGray, // indicators (PIN code)
decorationColor: Palette.darkGray, // switch (PIN code) decorationColor: Palette.darkGray, // switch (PIN code)
backgroundColor: Colors.white // alert right button
), ),
// body2 -> bodyLarge // body2 -> bodyLarge
bodyLarge: TextStyle( bodyLarge: TextStyle(
decorationColor: Colors.white, // alert left button,
backgroundColor: Palette.dullGray // keyboard bar color backgroundColor: Palette.dullGray // keyboard bar color
), ),
), ),

View file

@ -20,6 +20,7 @@ abstract class ThemeBase {
Color get primaryColor; Color get primaryColor;
Color get primaryTextColor; Color get primaryTextColor;
Color get containerColor; Color get containerColor;
Color get dialogBackgroundColor;
ColorScheme get colorScheme => ColorScheme.fromSeed( ColorScheme get colorScheme => ColorScheme.fromSeed(
brightness: brightness, brightness: brightness,
@ -37,5 +38,6 @@ abstract class ThemeBase {
.copyWith( .copyWith(
primaryColor: primaryColor, primaryColor: primaryColor,
cardColor: containerColor, cardColor: containerColor,
dialogBackgroundColor: dialogBackgroundColor,
extensions: [pageGradientTheme]); extensions: [pageGradientTheme]);
} }