diff --git a/lib/src/screens/disclaimer/disclaimer_page.dart b/lib/src/screens/disclaimer/disclaimer_page.dart index b8c7c0622..32ec85e39 100644 --- a/lib/src/screens/disclaimer/disclaimer_page.dart +++ b/lib/src/screens/disclaimer/disclaimer_page.dart @@ -1,6 +1,7 @@ import 'dart:ui'; import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/routes.dart'; +import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; @@ -274,14 +275,8 @@ class DisclaimerBodyState extends State { .popAndPushNamed(Routes.welcome) : null, text: 'Accept', - color: Theme.of(context) - .accentTextTheme! - .titleSmall! - .decorationColor!, - textColor: Theme.of(context) - .accentTextTheme! - .headlineSmall! - .decorationColor!), + color: Theme.of(context).extension()!.createNewWalletButtonBackgroundColor, + textColor: Theme.of(context).extension()!.restoreWalletButtonTextColor), ), ], ], diff --git a/lib/src/screens/new_wallet/widgets/select_button.dart b/lib/src/screens/new_wallet/widgets/select_button.dart index 8257d94ce..d21792d5c 100644 --- a/lib/src/screens/new_wallet/widgets/select_button.dart +++ b/lib/src/screens/new_wallet/widgets/select_button.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:cake_wallet/themes/extensions/filter_theme.dart'; +import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart'; class SelectButton extends StatelessWidget { SelectButton({ @@ -20,16 +21,10 @@ class SelectButton extends StatelessWidget { ? Colors.green : Theme.of(context).cardColor; final textColor = isSelected - ? Theme.of(context) - .accentTextTheme! - .headlineSmall! - .decorationColor! + ? Theme.of(context).extension()!.restoreWalletButtonTextColor : Theme.of(context).primaryTextTheme!.titleLarge!.color!; final arrowColor = isSelected - ? Theme.of(context) - .accentTextTheme! - .headlineSmall! - .decorationColor! + ? Theme.of(context).extension()!.restoreWalletButtonTextColor : Theme.of(context).extension()!.titlesColor; final selectArrowImage = Image.asset('assets/images/select_arrow.png', diff --git a/lib/src/screens/restore/wallet_restore_page.dart b/lib/src/screens/restore/wallet_restore_page.dart index 8c35a24f1..e42eec313 100644 --- a/lib/src/screens/restore/wallet_restore_page.dart +++ b/lib/src/screens/restore/wallet_restore_page.dart @@ -23,6 +23,7 @@ import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/widgets/base_text_form_field.dart'; import 'package:cake_wallet/core/seed_validator.dart'; import 'package:cake_wallet/view_model/restore/restore_mode.dart'; +import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart'; class WalletRestorePage extends BasePage { WalletRestorePage(this.walletRestoreViewModel) @@ -192,14 +193,8 @@ class WalletRestorePage extends BasePage { return LoadingPrimaryButton( onPressed: _confirmForm, text: S.of(context).restore_recover, - color: Theme.of(context) - .accentTextTheme! - .titleSmall! - .decorationColor!, - textColor: Theme.of(context) - .accentTextTheme! - .headlineSmall! - .decorationColor!, + color: Theme.of(context).extension()!.createNewWalletButtonBackgroundColor, + textColor: Theme.of(context).extension()!.restoreWalletButtonTextColor, isLoading: walletRestoreViewModel.state is IsExecutingState, isDisabled: !walletRestoreViewModel.isButtonEnabled, ); diff --git a/lib/src/screens/wallet_list/wallet_list_page.dart b/lib/src/screens/wallet_list/wallet_list_page.dart index eed068572..7ba40965c 100644 --- a/lib/src/screens/wallet_list/wallet_list_page.dart +++ b/lib/src/screens/wallet_list/wallet_list_page.dart @@ -17,6 +17,7 @@ import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:cake_wallet/wallet_type_utils.dart'; +import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart'; class WalletListPage extends BasePage { WalletListPage({required this.walletListViewModel, required this.authService}); @@ -74,7 +75,7 @@ class WalletListBodyState extends State { itemBuilder: (__, index) { final wallet = widget.walletListViewModel.wallets[index]; final currentColor = wallet.isCurrent - ? Theme.of(context).accentTextTheme!.titleSmall!.decorationColor! + ? Theme.of(context).extension()!.createNewWalletButtonBackgroundColor : Theme.of(context).colorScheme.background; final row = GestureDetector( onTap: () async { diff --git a/lib/src/screens/welcome/welcome_page.dart b/lib/src/screens/welcome/welcome_page.dart index 4b70e1012..900f8fc45 100644 --- a/lib/src/screens/welcome/welcome_page.dart +++ b/lib/src/screens/welcome/welcome_page.dart @@ -7,6 +7,7 @@ import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/wallet_type_utils.dart'; import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart'; +import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart'; class WelcomePage extends BasePage { static const aspectRatioImage = 1.25; @@ -52,10 +53,7 @@ class WelcomePage extends BasePage { final newWalletImage = Image.asset('assets/images/new_wallet.png', height: 12, width: 12, - color: Theme.of(context) - .accentTextTheme! - .headlineSmall! - .decorationColor!); + color: Theme.of(context).extension()!.restoreWalletButtonTextColor); final restoreWalletImage = Image.asset('assets/images/restore_wallet.png', height: 12, width: 12, @@ -143,14 +141,8 @@ class WelcomePage extends BasePage { Navigator.pushNamed(context, Routes.newWalletFromWelcome), image: newWalletImage, text: S.of(context).create_new, - color: Theme.of(context) - .accentTextTheme! - .titleSmall! - .decorationColor!, - textColor: Theme.of(context) - .accentTextTheme! - .headlineSmall! - .decorationColor!, + color: Theme.of(context).extension()!.createNewWalletButtonBackgroundColor, + textColor: Theme.of(context).extension()!.restoreWalletButtonTextColor, ), ), Padding( diff --git a/lib/themes/bright_theme.dart b/lib/themes/bright_theme.dart index ffe7c6e5e..7aabde12b 100644 --- a/lib/themes/bright_theme.dart +++ b/lib/themes/bright_theme.dart @@ -6,6 +6,7 @@ import 'package:cake_wallet/themes/extensions/indicator_dot_theme.dart'; import 'package:cake_wallet/themes/extensions/menu_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/wallet_list_theme.dart'; import 'package:cake_wallet/themes/light_theme.dart'; import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/generated/i18n.dart'; @@ -69,6 +70,10 @@ class BrightTheme extends LightTheme { buttonColor: Colors.white.withOpacity(0.2), iconColor: Colors.white); + @override + WalletListTheme get walletListTheme => super.walletListTheme.copyWith( + createNewWalletButtonBackgroundColor: Palette.moderateSlateBlue); + @override ThemeData get themeData => super.themeData.copyWith( indicatorColor: Colors.white.withOpacity(0.5), // page indicator @@ -183,18 +188,5 @@ class BrightTheme extends LightTheme { decorationColor: Palette.darkBlueCraiola, // text color (information page) ), - // subtitle -> titleSmall - titleSmall: TextStyle( - //decorationColor: Palette.blueCraiola // crete new wallet button background (wallet list page) - decorationColor: Palette - .moderateSlateBlue // crete new wallet button background (wallet list page) - ), - // headline -> headlineSmall - headlineSmall: TextStyle( - color: Palette - .moderateLavender, // first gradient color of wallet action buttons (wallet list page) - decorationColor: Colors - .white // restore wallet button text color (wallet list page) - ), )); } diff --git a/lib/themes/dark_theme.dart b/lib/themes/dark_theme.dart index da7a2a757..cf546e5c7 100644 --- a/lib/themes/dark_theme.dart +++ b/lib/themes/dark_theme.dart @@ -11,6 +11,7 @@ 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/support_page_theme.dart'; import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart'; +import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart'; import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/palette.dart'; @@ -112,6 +113,11 @@ class DarkTheme extends ThemeBase { buttonColor: PaletteDark.oceanBlue, iconColor: PaletteDark.wildBlue); + @override + WalletListTheme get walletListTheme => WalletListTheme( + restoreWalletButtonTextColor: Palette.darkBlueCraiola, + createNewWalletButtonBackgroundColor: Colors.white); + @override ThemeData get themeData => super.themeData.copyWith( indicatorColor: PaletteDark.cyanBlue, // page indicator @@ -230,18 +236,6 @@ class DarkTheme extends ThemeBase { bodySmall: TextStyle( decorationColor: Palette.darkLavender, // text color (information page) ), - // subtitle -> titleSmall - titleSmall: TextStyle( - decorationColor: Colors - .white // crete new wallet button background (wallet list page) - ), - // headline -> headlineSmall - headlineSmall: TextStyle( - color: PaletteDark - .distantBlue, // first gradient color of wallet action buttons (wallet list page) - decorationColor: Palette - .darkBlueCraiola // restore wallet button text color (wallet list page) - ), ), ); } diff --git a/lib/themes/extensions/wallet_list_theme.dart b/lib/themes/extensions/wallet_list_theme.dart new file mode 100644 index 000000000..aac3a193a --- /dev/null +++ b/lib/themes/extensions/wallet_list_theme.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; + +class WalletListTheme extends ThemeExtension { + final Color restoreWalletButtonTextColor; + final Color createNewWalletButtonBackgroundColor; + + WalletListTheme( + {required this.restoreWalletButtonTextColor, + required this.createNewWalletButtonBackgroundColor}); + + @override + WalletListTheme copyWith( + {Color? restoreWalletButtonTextColor, + Color? createNewWalletButtonBackgroundColor}) => + WalletListTheme( + restoreWalletButtonTextColor: + restoreWalletButtonTextColor ?? this.restoreWalletButtonTextColor, + createNewWalletButtonBackgroundColor: + createNewWalletButtonBackgroundColor ?? + this.createNewWalletButtonBackgroundColor); + + @override + WalletListTheme lerp(ThemeExtension? other, double t) { + if (other is! WalletListTheme) { + return this; + } + + return WalletListTheme( + restoreWalletButtonTextColor: Color.lerp(restoreWalletButtonTextColor, + other.restoreWalletButtonTextColor, t) ?? + restoreWalletButtonTextColor, + createNewWalletButtonBackgroundColor: Color.lerp( + createNewWalletButtonBackgroundColor, + other.createNewWalletButtonBackgroundColor, + t) ?? + createNewWalletButtonBackgroundColor); + } +} diff --git a/lib/themes/light_theme.dart b/lib/themes/light_theme.dart index 2fdb85856..4b9af1f35 100644 --- a/lib/themes/light_theme.dart +++ b/lib/themes/light_theme.dart @@ -11,6 +11,7 @@ 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/support_page_theme.dart'; import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart'; +import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart'; import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/palette.dart'; @@ -113,6 +114,11 @@ class LightTheme extends ThemeBase { buttonColor: Palette.blueAlice, iconColor: PaletteDark.wildBlue); + @override + WalletListTheme get walletListTheme => WalletListTheme( + restoreWalletButtonTextColor: Colors.white, + createNewWalletButtonBackgroundColor: Palette.protectiveBlue); + @override ThemeData get themeData => super.themeData.copyWith( indicatorColor: @@ -231,18 +237,6 @@ class LightTheme extends ThemeBase { bodySmall: TextStyle( decorationColor: Palette.darkBlueCraiola, // text color (information page) ), - // subtitle -> titleSmall - titleSmall: TextStyle( - decorationColor: Palette - .protectiveBlue // crete new wallet button background (wallet list page) - ), - // headline -> headlineSmall - headlineSmall: TextStyle( - color: Palette - .moderateLavender, // first gradient color of wallet action buttons (wallet list page) - decorationColor: Colors - .white // restore wallet button text color (wallet list page) - ), ), ); } diff --git a/lib/themes/theme_base.dart b/lib/themes/theme_base.dart index c35515b07..e2867623d 100644 --- a/lib/themes/theme_base.dart +++ b/lib/themes/theme_base.dart @@ -10,6 +10,7 @@ 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/support_page_theme.dart'; import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart'; +import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart'; import 'package:flutter/material.dart'; enum ThemeType { light, bright, dark } @@ -70,6 +71,8 @@ abstract class ThemeBase { FilterTheme get filterTheme; + WalletListTheme get walletListTheme; + ThemeData get themeData => generatedThemeData.copyWith( primaryColor: primaryColor, cardColor: containerColor, @@ -87,6 +90,7 @@ abstract class ThemeBase { addressTheme, menuTheme, filterTheme, + walletListTheme, ], scrollbarTheme: ScrollbarThemeData( thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),