refactor: create PinCodeTheme for accentTextTheme.bodyMedium

This commit is contained in:
Rafael Saes 2023-07-03 13:38:39 -03:00
parent 2ef03ceda9
commit 4ffeb21c4c
6 changed files with 22 additions and 27 deletions

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_bar.dart';
import 'package:another_flushbar/flushbar.dart'; import 'package:another_flushbar/flushbar.dart';
@ -163,10 +164,7 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
.primaryTextTheme! .primaryTextTheme!
.titleLarge! .titleLarge!
.color! .color!
: Theme.of(context) : Theme.of(context).extension<PinCodeTheme>()!.indicatorsColor
.accentTextTheme!
.bodyMedium!
.color!
.withOpacity(0.25), .withOpacity(0.25),
)); ));
}), }),
@ -185,10 +183,7 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
style: TextStyle( style: TextStyle(
fontSize: 14.0, fontSize: 14.0,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
color: Theme.of(context) color: Theme.of(context).extension<PinCodeTheme>()!.switchColor),
.accentTextTheme!
.bodyMedium!
.decorationColor!),
), ),
) )
], ],

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/utils/share_util.dart'; import 'package:cake_wallet/utils/share_util.dart';
@ -185,10 +186,7 @@ class WalletSeedPage extends BasePage {
S.of(context).copied_to_clipboard); S.of(context).copied_to_clipboard);
}, },
text: S.of(context).copy, text: S.of(context).copy,
color: Theme.of(context) color: Theme.of(context).extension<PinCodeTheme>()!.indicatorsColor,
.accentTextTheme!
.bodyMedium!
.color!,
textColor: Colors.white)), textColor: Colors.white)),
)) ))
], ],

View file

@ -235,9 +235,5 @@ class BrightTheme extends LightTheme {
backgroundColor: Colors.black, // icon color on support page (moonpay, github) backgroundColor: Colors.black, // icon color on support page (moonpay, github)
decorationColor: Colors.white.withOpacity(0.4) // hint text (exchange page) decorationColor: Colors.white.withOpacity(0.4) // hint text (exchange page)
), ),
// body -> bodyMedium ));
bodyMedium: TextStyle(
color: Palette.darkGray, // indicators (PIN code)
decorationColor: Palette.darkGray, // switch (PIN code)
)));
} }

View file

@ -1,5 +1,6 @@
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart'; import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart'; import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart'; import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
@ -41,6 +42,11 @@ class DarkTheme extends ThemeBase {
KeyboardTheme get keyboardTheme => KeyboardTheme get keyboardTheme =>
KeyboardTheme(keyboardBarColor: PaletteDark.granite); KeyboardTheme(keyboardBarColor: PaletteDark.granite);
@override
PinCodeTheme get pinCodeTheme => PinCodeTheme(
indicatorsColor: PaletteDark.indicatorVioletBlue,
switchColor: PaletteDark.lightPurpleBlue);
@override @override
ThemeData get themeData => super.themeData.copyWith( ThemeData get themeData => super.themeData.copyWith(
indicatorColor: PaletteDark.cyanBlue, // page indicator indicatorColor: PaletteDark.cyanBlue, // page indicator
@ -254,11 +260,6 @@ class DarkTheme extends ThemeBase {
decorationColor: decorationColor:
PaletteDark.lightBlueGrey // hint text (exchange page) PaletteDark.lightBlueGrey // hint text (exchange page)
), ),
// body1 -> bodyMedium
bodyMedium: TextStyle(
color: PaletteDark.indicatorVioletBlue, // indicators (PIN code)
decorationColor: PaletteDark.lightPurpleBlue, // switch (PIN code)
),
), ),
); );
} }

View file

@ -1,5 +1,6 @@
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart'; import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart'; import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart'; import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
@ -42,6 +43,11 @@ class LightTheme extends ThemeBase {
KeyboardTheme get keyboardTheme => KeyboardTheme get keyboardTheme =>
KeyboardTheme(keyboardBarColor: Palette.dullGray); KeyboardTheme(keyboardBarColor: Palette.dullGray);
@override
PinCodeTheme get pinCodeTheme => PinCodeTheme(
indicatorsColor: Palette.darkGray,
switchColor: Palette.darkGray);
@override @override
ThemeData get themeData => super.themeData.copyWith( ThemeData get themeData => super.themeData.copyWith(
indicatorColor: indicatorColor:
@ -250,11 +256,6 @@ class LightTheme extends ThemeBase {
decorationColor: decorationColor:
Colors.white.withOpacity(0.4) // hint text (exchange page) Colors.white.withOpacity(0.4) // hint text (exchange page)
), ),
// body -> bodyMedium
bodyMedium: TextStyle(
color: Palette.darkGray, // indicators (PIN code)
decorationColor: Palette.darkGray, // switch (PIN code)
),
), ),
); );
} }

View file

@ -1,6 +1,7 @@
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart'; import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
import 'package:cake_wallet/themes/extensions/dashboard_gradient_theme.dart'; import 'package:cake_wallet/themes/extensions/dashboard_gradient_theme.dart';
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart'; import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart'; import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -45,6 +46,8 @@ abstract class ThemeBase {
KeyboardTheme get keyboardTheme; KeyboardTheme get keyboardTheme;
PinCodeTheme get pinCodeTheme;
ThemeData get themeData => generatedThemeData.copyWith( ThemeData get themeData => generatedThemeData.copyWith(
primaryColor: primaryColor, primaryColor: primaryColor,
cardColor: containerColor, cardColor: containerColor,
@ -54,6 +57,7 @@ abstract class ThemeBase {
scrollbarTheme, scrollbarTheme,
syncIndicatorStyle, syncIndicatorStyle,
keyboardTheme, keyboardTheme,
pinCodeTheme,
], ],
scrollbarTheme: ScrollbarThemeData( scrollbarTheme: ScrollbarThemeData(
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor), thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),