mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-11 05:14:46 +00:00
refactor: create NewWalletTheme for accentTextTheme.displayMedium
This commit is contained in:
parent
bc8ce7bf60
commit
6b691475fd
9 changed files with 65 additions and 54 deletions
|
@ -3,6 +3,7 @@ import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
||||||
import 'package:cake_wallet/src/screens/nodes/widgets/node_form.dart';
|
import 'package:cake_wallet/src/screens/nodes/widgets/node_form.dart';
|
||||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_choices_cell.dart';
|
import 'package:cake_wallet/src/screens/settings/widgets/settings_choices_cell.dart';
|
||||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
|
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
||||||
import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.dart';
|
import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/advanced_privacy_settings_view_model.dart';
|
import 'package:cake_wallet/view_model/advanced_privacy_settings_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/settings/choices_list_item.dart';
|
import 'package:cake_wallet/view_model/settings/choices_list_item.dart';
|
||||||
|
@ -121,10 +122,7 @@ class _AdvancedPrivacySettingsBodyState extends State<AdvancedPrivacySettingsBod
|
||||||
S.of(context).settings_can_be_changed_later,
|
S.of(context).settings_can_be_changed_later,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
|
||||||
.accentTextTheme!
|
|
||||||
.displayMedium!
|
|
||||||
.color,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -17,6 +17,7 @@ import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_pick
|
||||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||||
import 'package:cake_wallet/core/execution_state.dart';
|
import 'package:cake_wallet/core/execution_state.dart';
|
||||||
import 'package:cake_wallet/view_model/wallet_new_vm.dart';
|
import 'package:cake_wallet/view_model/wallet_new_vm.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
||||||
|
|
||||||
class NewWalletPage extends BasePage {
|
class NewWalletPage extends BasePage {
|
||||||
NewWalletPage(this._walletNewVM);
|
NewWalletPage(this._walletNewVM);
|
||||||
|
@ -125,24 +126,15 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||||
hintStyle: TextStyle(
|
hintStyle: TextStyle(
|
||||||
fontSize: 18.0,
|
fontSize: 18.0,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<NewWalletTheme>()!.hintTextColor),
|
||||||
.accentTextTheme!
|
|
||||||
.displayMedium!
|
|
||||||
.color),
|
|
||||||
hintText: S.of(context).wallet_name,
|
hintText: S.of(context).wallet_name,
|
||||||
focusedBorder: UnderlineInputBorder(
|
focusedBorder: UnderlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<NewWalletTheme>()!.underlineColor,
|
||||||
.accentTextTheme!
|
|
||||||
.displayMedium!
|
|
||||||
.decorationColor!,
|
|
||||||
width: 1.0)),
|
width: 1.0)),
|
||||||
enabledBorder: UnderlineInputBorder(
|
enabledBorder: UnderlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<NewWalletTheme>()!.underlineColor,
|
||||||
.accentTextTheme!
|
|
||||||
.displayMedium!
|
|
||||||
.decorationColor!,
|
|
||||||
width: 1.0),
|
width: 1.0),
|
||||||
),
|
),
|
||||||
suffixIcon: Semantics(
|
suffixIcon: Semantics(
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
||||||
|
|
||||||
class SweepingWalletPage extends BasePage {
|
class SweepingWalletPage extends BasePage {
|
||||||
SweepingWalletPage();
|
SweepingWalletPage();
|
||||||
|
@ -82,10 +83,7 @@ class _SweepingWalletWidgetState extends State<SweepingWalletWidget> {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
|
||||||
.accentTextTheme!
|
|
||||||
.displayMedium!
|
|
||||||
.color,
|
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
@ -112,10 +110,7 @@ class _SweepingWalletWidgetState extends State<SweepingWalletWidget> {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
|
||||||
.accentTextTheme!
|
|
||||||
.displayMedium!
|
|
||||||
.color,
|
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
|
@ -6,6 +6,7 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/wallet_type_utils.dart';
|
import 'package:cake_wallet/wallet_type_utils.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
||||||
|
|
||||||
class WelcomePage extends BasePage {
|
class WelcomePage extends BasePage {
|
||||||
static const aspectRatioImage = 1.25;
|
static const aspectRatioImage = 1.25;
|
||||||
|
@ -90,10 +91,7 @@ class WelcomePage extends BasePage {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
|
||||||
.accentTextTheme!
|
|
||||||
.displayMedium!
|
|
||||||
.color,
|
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
@ -120,10 +118,7 @@ class WelcomePage extends BasePage {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
|
||||||
.accentTextTheme!
|
|
||||||
.displayMedium!
|
|
||||||
.color,
|
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
@ -137,10 +132,7 @@ class WelcomePage extends BasePage {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
|
||||||
.accentTextTheme!
|
|
||||||
.displayMedium!
|
|
||||||
.color,
|
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/new_wallet_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/light_theme.dart';
|
import 'package:cake_wallet/themes/light_theme.dart';
|
||||||
import 'package:cake_wallet/themes/theme_base.dart';
|
import 'package:cake_wallet/themes/theme_base.dart';
|
||||||
|
@ -40,6 +41,11 @@ class BrightTheme extends LightTheme {
|
||||||
secondGradientTopPanelColor: Palette.pinkFlamingo,
|
secondGradientTopPanelColor: Palette.pinkFlamingo,
|
||||||
firstGradientTopPanelColor: Palette.blueCraiola);
|
firstGradientTopPanelColor: Palette.blueCraiola);
|
||||||
|
|
||||||
|
@override
|
||||||
|
NewWalletTheme get newWalletTheme => NewWalletTheme(
|
||||||
|
hintTextColor: Palette.darkGray,
|
||||||
|
underlineColor: Palette.periwinkleCraiola);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeData get themeData => super.themeData.copyWith(
|
ThemeData get themeData => super.themeData.copyWith(
|
||||||
indicatorColor: Colors.white.withOpacity(0.5), // page indicator
|
indicatorColor: Colors.white.withOpacity(0.5), // page indicator
|
||||||
|
@ -206,11 +212,5 @@ class BrightTheme extends LightTheme {
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Colors.white.withOpacity(0.5) // text on balance page
|
Colors.white.withOpacity(0.5) // text on balance page
|
||||||
),
|
),
|
||||||
// display3 -> displayMedium
|
|
||||||
displayMedium: TextStyle(
|
|
||||||
color: Palette.darkGray, // hint text (new wallet page)
|
|
||||||
decorationColor:
|
|
||||||
Palette.periwinkleCraiola, // underline (new wallet page)
|
|
||||||
),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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/exchange_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/exchange_page_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/new_wallet_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||||
|
@ -68,6 +69,11 @@ class DarkTheme extends ThemeBase {
|
||||||
firstGradientTopPanelColor: PaletteDark.wildVioletBlue,
|
firstGradientTopPanelColor: PaletteDark.wildVioletBlue,
|
||||||
receiveAmountColor: PaletteDark.darkCyanBlue);
|
receiveAmountColor: PaletteDark.darkCyanBlue);
|
||||||
|
|
||||||
|
@override
|
||||||
|
NewWalletTheme get newWalletTheme => NewWalletTheme(
|
||||||
|
hintTextColor: PaletteDark.cyanBlue,
|
||||||
|
underlineColor: PaletteDark.darkGrey);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeData get themeData => super.themeData.copyWith(
|
ThemeData get themeData => super.themeData.copyWith(
|
||||||
indicatorColor: PaletteDark.cyanBlue, // page indicator
|
indicatorColor: PaletteDark.cyanBlue, // page indicator
|
||||||
|
@ -240,12 +246,6 @@ class DarkTheme extends ThemeBase {
|
||||||
PaletteDark.darkCyanBlue, // hint text (seed widget)
|
PaletteDark.darkCyanBlue, // hint text (seed widget)
|
||||||
backgroundColor: PaletteDark.cyanBlue // text on balance page
|
backgroundColor: PaletteDark.cyanBlue // text on balance page
|
||||||
),
|
),
|
||||||
// display3 -> displayMedium
|
|
||||||
displayMedium: TextStyle(
|
|
||||||
color: PaletteDark.cyanBlue, // hint text (new wallet page)
|
|
||||||
decorationColor:
|
|
||||||
PaletteDark.darkGrey, // underline (new wallet page)
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
30
lib/themes/extensions/new_wallet_theme.dart
Normal file
30
lib/themes/extensions/new_wallet_theme.dart
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class NewWalletTheme extends ThemeExtension<NewWalletTheme> {
|
||||||
|
final Color hintTextColor;
|
||||||
|
final Color underlineColor;
|
||||||
|
|
||||||
|
NewWalletTheme({required this.hintTextColor, required this.underlineColor});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Object get type => NewWalletTheme;
|
||||||
|
|
||||||
|
@override
|
||||||
|
NewWalletTheme copyWith({Color? hintTextColor, Color? underlineColor}) =>
|
||||||
|
NewWalletTheme(
|
||||||
|
hintTextColor: hintTextColor ?? this.hintTextColor,
|
||||||
|
underlineColor: underlineColor ?? this.underlineColor);
|
||||||
|
|
||||||
|
@override
|
||||||
|
NewWalletTheme lerp(ThemeExtension<NewWalletTheme>? other, double t) {
|
||||||
|
if (other is! NewWalletTheme) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewWalletTheme(
|
||||||
|
hintTextColor:
|
||||||
|
Color.lerp(hintTextColor, other.hintTextColor, t) ?? hintTextColor,
|
||||||
|
underlineColor: Color.lerp(underlineColor, other.underlineColor, t) ??
|
||||||
|
underlineColor);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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/exchange_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/exchange_page_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/new_wallet_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||||
|
@ -69,6 +70,11 @@ class LightTheme extends ThemeBase {
|
||||||
firstGradientTopPanelColor: Palette.blueCraiola,
|
firstGradientTopPanelColor: Palette.blueCraiola,
|
||||||
receiveAmountColor: Palette.niagara);
|
receiveAmountColor: Palette.niagara);
|
||||||
|
|
||||||
|
@override
|
||||||
|
NewWalletTheme get newWalletTheme => NewWalletTheme(
|
||||||
|
hintTextColor: Palette.darkGray,
|
||||||
|
underlineColor: Palette.periwinkleCraiola);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeData get themeData => super.themeData.copyWith(
|
ThemeData get themeData => super.themeData.copyWith(
|
||||||
indicatorColor:
|
indicatorColor:
|
||||||
|
@ -237,12 +243,6 @@ class LightTheme extends ThemeBase {
|
||||||
backgroundColor: Palette.darkBlueCraiola
|
backgroundColor: Palette.darkBlueCraiola
|
||||||
.withOpacity(0.67) // text on balance page
|
.withOpacity(0.67) // text on balance page
|
||||||
),
|
),
|
||||||
// display3 -> displayMedium
|
|
||||||
displayMedium: TextStyle(
|
|
||||||
color: Palette.darkGray, // hint text (new wallet page)
|
|
||||||
decorationColor:
|
|
||||||
Palette.periwinkleCraiola, // underline (new wallet page)
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/exchange_page_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/new_wallet_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||||
|
@ -55,6 +56,8 @@ abstract class ThemeBase {
|
||||||
|
|
||||||
ExchangePageTheme get exchangePageTheme;
|
ExchangePageTheme get exchangePageTheme;
|
||||||
|
|
||||||
|
NewWalletTheme get newWalletTheme;
|
||||||
|
|
||||||
ThemeData get themeData => generatedThemeData.copyWith(
|
ThemeData get themeData => generatedThemeData.copyWith(
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
cardColor: containerColor,
|
cardColor: containerColor,
|
||||||
|
@ -67,6 +70,7 @@ abstract class ThemeBase {
|
||||||
pinCodeTheme,
|
pinCodeTheme,
|
||||||
supportPageTheme,
|
supportPageTheme,
|
||||||
exchangePageTheme,
|
exchangePageTheme,
|
||||||
|
newWalletTheme,
|
||||||
],
|
],
|
||||||
scrollbarTheme: ScrollbarThemeData(
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),
|
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),
|
||||||
|
|
Loading…
Reference in a new issue