From bc8ce7bf60174bb72328c1f74a382b1d4208a638 Mon Sep 17 00:00:00 2001 From: Rafael Saes Date: Mon, 3 Jul 2023 15:15:58 -0300 Subject: [PATCH] refactor: create DashboardPageTheme and use textColor --- lib/src/screens/dashboard/dashboard_page.dart | 11 ++-- .../desktop_action_button.dart | 11 ++-- .../dashboard/widgets/action_button.dart | 6 +-- .../dashboard/widgets/address_page.dart | 13 ++--- .../widgets/anonpay_transaction_row.dart | 5 +- .../dashboard/widgets/balance_page.dart | 41 ++++----------- .../screens/dashboard/widgets/header_row.dart | 6 +-- .../dashboard/widgets/market_place_page.dart | 6 +-- .../screens/dashboard/widgets/order_row.dart | 5 +- .../present_receive_option_picker.dart | 6 +-- .../screens/dashboard/widgets/trade_row.dart | 5 +- .../dashboard/widgets/transaction_raw.dart | 7 ++- .../ionia/cards/ionia_account_cards_page.dart | 6 +-- .../ionia/cards/ionia_manage_cards_page.dart | 19 +++---- .../ionia/cards/ionia_more_options_page.dart | 6 +-- .../screens/receive/anonpay_receive_page.dart | 16 ++---- .../screens/receive/fullscreen_qr_page.dart | 11 ++-- .../receive/widgets/copy_link_item.dart | 16 ++---- .../receive/widgets/currency_input_field.dart | 17 +++---- .../screens/receive/widgets/qr_widget.dart | 16 ++---- .../release_notes/release_notes_screen.dart | 16 ++---- lib/src/screens/yat_emoji_id.dart | 3 +- lib/src/widgets/gradient_background.dart | 14 ++--- lib/src/widgets/introducing_card.dart | 11 ++-- lib/src/widgets/market_place_item.dart | 11 ++-- lib/themes/bright_theme.dart | 13 +++-- lib/themes/dark_theme.dart | 2 - .../extensions/dashboard_gradient_theme.dart | 41 --------------- .../extensions/dashboard_page_theme.dart | 51 +++++++++++++++++++ lib/themes/light_theme.dart | 2 - lib/themes/theme_base.dart | 11 ++-- 31 files changed, 155 insertions(+), 249 deletions(-) delete mode 100644 lib/themes/extensions/dashboard_gradient_theme.dart create mode 100644 lib/themes/extensions/dashboard_page_theme.dart diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index 5fe503289..2e7b277e3 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -30,6 +30,7 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:smooth_page_indicator/smooth_page_indicator.dart'; import 'package:cake_wallet/main.dart'; import 'package:cake_wallet/src/screens/release_notes/release_notes_screen.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class DashboardPage extends StatelessWidget { DashboardPage({ @@ -89,10 +90,7 @@ class _DashboardPageView extends BasePage { @override Widget trailing(BuildContext context) { final menuButton = Image.asset('assets/images/menu.png', - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor); + color: Theme.of(context).extension()!.textColor); return Container( alignment: Alignment.centerRight, @@ -199,10 +197,7 @@ class _DashboardPageView extends BasePage { color: action.isEnabled?.call( dashboardViewModel) ?? true - ? Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor! + ? Theme.of(context).extension()!.textColor : Theme.of(context) .accentTextTheme! .displaySmall! diff --git a/lib/src/screens/dashboard/desktop_widgets/desktop_action_button.dart b/lib/src/screens/dashboard/desktop_widgets/desktop_action_button.dart index 9e2c974f3..ed5cedc28 100644 --- a/lib/src/screens/dashboard/desktop_widgets/desktop_action_button.dart +++ b/lib/src/screens/dashboard/desktop_widgets/desktop_action_button.dart @@ -1,4 +1,5 @@ import 'package:auto_size_text/auto_size_text.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart'; import 'package:flutter/material.dart'; @@ -42,10 +43,7 @@ class DesktopActionButton extends StatelessWidget { height: 30, width: 30, color: isEnabled - ? Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor! + ? Theme.of(context).extension()!.textColor : Theme.of(context) .accentTextTheme! .displaySmall! @@ -59,10 +57,7 @@ class DesktopActionButton extends StatelessWidget { fontFamily: 'Lato', fontWeight: FontWeight.bold, color: isEnabled - ? Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor! + ? Theme.of(context).extension()!.textColor : null, height: 1, ), diff --git a/lib/src/screens/dashboard/widgets/action_button.dart b/lib/src/screens/dashboard/widgets/action_button.dart index a3626fe3f..5613a9272 100644 --- a/lib/src/screens/dashboard/widgets/action_button.dart +++ b/lib/src/screens/dashboard/widgets/action_button.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class ActionButton extends StatelessWidget { ActionButton( @@ -46,10 +47,7 @@ class ActionButton extends StatelessWidget { style: TextStyle( fontSize: 10, color: textColor ?? - Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!), + Theme.of(context).extension()!.textColor), ) ], ), diff --git a/lib/src/screens/dashboard/widgets/address_page.dart b/lib/src/screens/dashboard/widgets/address_page.dart index d039aeb12..8dba63dc3 100644 --- a/lib/src/screens/dashboard/widgets/address_page.dart +++ b/lib/src/screens/dashboard/widgets/address_page.dart @@ -24,6 +24,7 @@ import 'package:keyboard_actions/keyboard_actions.dart'; import 'package:mobx/mobx.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:cake_wallet/di.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class AddressPage extends BasePage { AddressPage({ @@ -55,7 +56,7 @@ class AddressPage extends BasePage { @override Color? get titleColor => - currentTheme.themeData.accentTextTheme.displayMedium!.backgroundColor; + currentTheme.themeData.extension()!.textColor; @override bool get resizeToAvoidBottomInset => false; @@ -204,18 +205,12 @@ class AddressPage extends BasePage { style: TextStyle( fontSize: 14, fontWeight: FontWeight.w500, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!), + color: Theme.of(context).extension()!.textColor), )), Icon( Icons.arrow_forward_ios, size: 14, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, ) ], ), diff --git a/lib/src/screens/dashboard/widgets/anonpay_transaction_row.dart b/lib/src/screens/dashboard/widgets/anonpay_transaction_row.dart index 3b33e8e22..2be9da4ba 100644 --- a/lib/src/screens/dashboard/widgets/anonpay_transaction_row.dart +++ b/lib/src/screens/dashboard/widgets/anonpay_transaction_row.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class AnonpayTransactionRow extends StatelessWidget { AnonpayTransactionRow({ @@ -37,12 +38,12 @@ class AnonpayTransactionRow extends StatelessWidget { style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, - color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!)), + color: Theme.of(context).extension()!.textColor)), Text(amount + ' ' + currency, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, - color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!)) + color: Theme.of(context).extension()!.textColor)) ]), SizedBox(height: 5), Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/src/screens/dashboard/widgets/balance_page.dart b/lib/src/screens/dashboard/widgets/balance_page.dart index ac872b81a..a5f72c710 100644 --- a/lib/src/screens/dashboard/widgets/balance_page.dart +++ b/lib/src/screens/dashboard/widgets/balance_page.dart @@ -8,6 +8,7 @@ import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:auto_size_text/auto_size_text.dart'; import 'package:cake_wallet/src/widgets/introducing_card.dart'; import 'package:cake_wallet/generated/i18n.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class BalancePage extends StatelessWidget { BalancePage({required this.dashboardViewModel, required this.settingsStore}); @@ -36,10 +37,7 @@ class BalancePage extends StatelessWidget { fontSize: 24, fontFamily: 'Lato', fontWeight: FontWeight.w600, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, height: 1), maxLines: 1, textAlign: TextAlign.center); @@ -129,10 +127,7 @@ class BalancePage extends StatelessWidget { fontSize: 24, fontFamily: 'Lato', fontWeight: FontWeight.w900, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, height: 1), maxLines: 1, textAlign: TextAlign.start), @@ -142,10 +137,7 @@ class BalancePage extends StatelessWidget { fontSize: 28, fontFamily: 'Lato', fontWeight: FontWeight.w800, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, height: 1)), ]), SizedBox( @@ -157,10 +149,7 @@ class BalancePage extends StatelessWidget { fontSize: 16, fontFamily: 'Lato', fontWeight: FontWeight.w500, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, height: 1)), SizedBox(height: 26), if (frozenBalance.isNotEmpty) @@ -182,10 +171,7 @@ class BalancePage extends StatelessWidget { fontSize: 20, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, height: 1), maxLines: 1, textAlign: TextAlign.center), @@ -197,10 +183,7 @@ class BalancePage extends StatelessWidget { fontSize: 12, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, height: 1), ), SizedBox(height: 24) @@ -222,10 +205,7 @@ class BalancePage extends StatelessWidget { fontSize: 20, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, height: 1), maxLines: 1, textAlign: TextAlign.center), @@ -239,10 +219,7 @@ class BalancePage extends StatelessWidget { fontSize: 12, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, height: 1), ) ])), diff --git a/lib/src/screens/dashboard/widgets/header_row.dart b/lib/src/screens/dashboard/widgets/header_row.dart index 44fdb6c59..659e5e374 100644 --- a/lib/src/screens/dashboard/widgets/header_row.dart +++ b/lib/src/screens/dashboard/widgets/header_row.dart @@ -3,6 +3,7 @@ import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class HeaderRow extends StatelessWidget { HeaderRow({required this.dashboardViewModel}); @@ -27,10 +28,7 @@ class HeaderRow extends StatelessWidget { style: TextStyle( fontSize: 20, fontWeight: FontWeight.w500, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!), + color: Theme.of(context).extension()!.textColor), ), GestureDetector( onTap: () { diff --git a/lib/src/screens/dashboard/widgets/market_place_page.dart b/lib/src/screens/dashboard/widgets/market_place_page.dart index 248353aca..f133386c8 100644 --- a/lib/src/screens/dashboard/widgets/market_place_page.dart +++ b/lib/src/screens/dashboard/widgets/market_place_page.dart @@ -8,6 +8,7 @@ import 'package:cw_core/wallet_type.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class MarketPlacePage extends StatelessWidget { MarketPlacePage({ @@ -40,10 +41,7 @@ class MarketPlacePage extends StatelessWidget { style: TextStyle( fontSize: 24, fontWeight: FontWeight.w500, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), ), Expanded( diff --git a/lib/src/screens/dashboard/widgets/order_row.dart b/lib/src/screens/dashboard/widgets/order_row.dart index 961f31784..296ff7bf3 100644 --- a/lib/src/screens/dashboard/widgets/order_row.dart +++ b/lib/src/screens/dashboard/widgets/order_row.dart @@ -1,6 +1,7 @@ import 'package:cake_wallet/buy/buy_provider_description.dart'; import 'package:cake_wallet/buy/get_buy_provider_icon.dart'; import 'package:flutter/material.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class OrderRow extends StatelessWidget { OrderRow({ @@ -48,14 +49,14 @@ class OrderRow extends StatelessWidget { style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, - color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor! + color: Theme.of(context).extension()!.textColor )), formattedAmount != null ? Text(formattedAmount! + ' ' + to, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, - color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor! + color: Theme.of(context).extension()!.textColor )) : Container() ]), diff --git a/lib/src/screens/dashboard/widgets/present_receive_option_picker.dart b/lib/src/screens/dashboard/widgets/present_receive_option_picker.dart index f447bc2ef..90f03c969 100644 --- a/lib/src/screens/dashboard/widgets/present_receive_option_picker.dart +++ b/lib/src/screens/dashboard/widgets/present_receive_option_picker.dart @@ -7,6 +7,7 @@ import 'package:cake_wallet/view_model/dashboard/receive_option_view_model.dart' import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:cake_wallet/generated/i18n.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class PresentReceiveOptionPicker extends StatelessWidget { PresentReceiveOptionPicker( @@ -18,10 +19,7 @@ class PresentReceiveOptionPicker extends StatelessWidget { @override Widget build(BuildContext context) { final textIconTheme = gradientBackground - ? Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor! + ? Theme.of(context).extension()!.textColor : Colors.white; final arrowBottom = Image.asset( 'assets/images/arrow_bottom_purple_icon.png', diff --git a/lib/src/screens/dashboard/widgets/trade_row.dart b/lib/src/screens/dashboard/widgets/trade_row.dart index 754e9d237..8b0e107cc 100644 --- a/lib/src/screens/dashboard/widgets/trade_row.dart +++ b/lib/src/screens/dashboard/widgets/trade_row.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cake_wallet/exchange/exchange_provider_description.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class TradeRow extends StatelessWidget { TradeRow({ @@ -43,14 +44,14 @@ class TradeRow extends StatelessWidget { style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, - color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!)), + color: Theme.of(context).extension()!.textColor)), formattedAmount != null ? Text(formattedAmount! + ' ' + amountCrypto, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, color: - Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!)) + Theme.of(context).extension()!.textColor)) : Container() ]), SizedBox(height: 5), diff --git a/lib/src/screens/dashboard/widgets/transaction_raw.dart b/lib/src/screens/dashboard/widgets/transaction_raw.dart index aae3397ee..cfc6001b9 100644 --- a/lib/src/screens/dashboard/widgets/transaction_raw.dart +++ b/lib/src/screens/dashboard/widgets/transaction_raw.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:cw_core/transaction_direction.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class TransactionRow extends StatelessWidget { TransactionRow( @@ -54,14 +55,12 @@ class TransactionRow extends StatelessWidget { style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, - color: Theme.of(context).accentTextTheme! - .displayMedium!.backgroundColor!)), + color: Theme.of(context).extension()!.textColor)), Text(formattedAmount, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, - color: Theme.of(context).accentTextTheme! - .displayMedium!.backgroundColor!)) + color: Theme.of(context).extension()!.textColor)) ]), SizedBox(height: 5), Row( diff --git a/lib/src/screens/ionia/cards/ionia_account_cards_page.dart b/lib/src/screens/ionia/cards/ionia_account_cards_page.dart index b13e21a39..8d3fa2dd8 100644 --- a/lib/src/screens/ionia/cards/ionia_account_cards_page.dart +++ b/lib/src/screens/ionia/cards/ionia_account_cards_page.dart @@ -10,6 +10,7 @@ import 'package:cake_wallet/view_model/ionia/ionia_account_view_model.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class IoniaAccountCardsPage extends BasePage { IoniaAccountCardsPage(this.ioniaAccountViewModel); @@ -161,10 +162,7 @@ class _IoniaCardListView extends StatelessWidget { if(isLoading){ return Center( child: CircularProgressIndicator( - backgroundColor: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + backgroundColor: Theme.of(context).extension()!.textColor, valueColor: AlwaysStoppedAnimation( Theme.of(context).extension()!.firstGradientBottomPanelColor), ), diff --git a/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart b/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart index 94f03289b..a7ea9123a 100644 --- a/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart +++ b/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart @@ -18,6 +18,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class IoniaManageCardsPage extends BasePage { IoniaManageCardsPage(this._cardsListViewModel): searchFocusNode = FocusNode() { @@ -59,10 +60,7 @@ class IoniaManageCardsPage extends BasePage { Widget leading(BuildContext context) { final _backButton = Icon( Icons.arrow_back_ios, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, size: 16, ); @@ -94,10 +92,7 @@ class IoniaManageCardsPage extends BasePage { return Text( S.of(context).gift_cards, style: textMediumSemiBold( - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), ); } @@ -230,7 +225,7 @@ class _IoniaManageCardsPageBodyState extends State { title: merchant.legalName, subTitle: merchant.avaibilityStatus, backgroundColor: Theme.of(context).extension()!.syncedBackgroundColor, - titleColor: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!, + titleColor: Theme.of(context).extension()!.textColor, subtitleColor: Theme.of(context).accentTextTheme!.displaySmall!.backgroundColor!, discount: merchant.discount, ); @@ -251,7 +246,7 @@ class _IoniaManageCardsPageBodyState extends State { } return Center( child: CircularProgressIndicator( - backgroundColor: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!, + backgroundColor: Theme.of(context).extension()!.textColor, valueColor: AlwaysStoppedAnimation(Theme.of(context).extension()!.firstGradientBottomPanelColor), ), ); @@ -280,7 +275,7 @@ class _SearchWidget extends StatelessWidget { return TextField( focusNode: focusNode, - style: TextStyle(color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!), + style: TextStyle(color: Theme.of(context).extension()!.textColor), controller: controller, decoration: InputDecoration( filled: true, @@ -335,7 +330,7 @@ class _TrailingIcon extends StatelessWidget { onPressed: onPressed, icon: Image.asset( asset, - color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), ), ); diff --git a/lib/src/screens/ionia/cards/ionia_more_options_page.dart b/lib/src/screens/ionia/cards/ionia_more_options_page.dart index 34f39c4ee..00f937b79 100644 --- a/lib/src/screens/ionia/cards/ionia_more_options_page.dart +++ b/lib/src/screens/ionia/cards/ionia_more_options_page.dart @@ -2,7 +2,7 @@ import 'package:cake_wallet/ionia/ionia_gift_card.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/generated/i18n.dart'; -import 'package:cake_wallet/themes/extensions/dashboard_gradient_theme.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; import 'package:cake_wallet/typography.dart'; import 'package:flutter/material.dart'; @@ -78,8 +78,8 @@ class _GradiantContainer extends StatelessWidget { borderRadius: BorderRadius.circular(15), gradient: LinearGradient( colors: [ - Theme.of(context).extension()!.secondGradientColor, - Theme.of(context).extension()!.firstGradientColor, + Theme.of(context).extension()!.secondGradientBackgroundColor, + Theme.of(context).extension()!.firstGradientBackgroundColor, ], begin: Alignment.topRight, end: Alignment.bottomLeft, diff --git a/lib/src/screens/receive/anonpay_receive_page.dart b/lib/src/screens/receive/anonpay_receive_page.dart index 3d3c4b2a6..acb2d9061 100644 --- a/lib/src/screens/receive/anonpay_receive_page.dart +++ b/lib/src/screens/receive/anonpay_receive_page.dart @@ -12,6 +12,7 @@ import 'package:cake_wallet/src/screens/receive/widgets/copy_link_item.dart'; import 'package:device_display_brightness/device_display_brightness.dart'; import 'package:flutter/material.dart'; import 'package:qr_flutter/qr_flutter.dart' as qr; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class AnonPayReceivePage extends BasePage { final AnonpayInfoBase invoiceInfo; @@ -31,10 +32,7 @@ class AnonPayReceivePage extends BasePage { Widget leading(BuildContext context) { final _backButton = Icon( Icons.arrow_back_ios, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, size: 16, ); @@ -61,10 +59,7 @@ class AnonPayReceivePage extends BasePage { fontSize: 18.0, fontWeight: FontWeight.bold, fontFamily: 'Lato', - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!), + color: Theme.of(context).extension()!.textColor), ), Text( invoiceInfo is AnonpayInvoiceInfo @@ -147,10 +142,7 @@ class AnonPayReceivePage extends BasePage { decoration: BoxDecoration( border: Border.all( width: 3, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), ), child: QrImage( diff --git a/lib/src/screens/receive/fullscreen_qr_page.dart b/lib/src/screens/receive/fullscreen_qr_page.dart index 54230deac..d11722ccf 100644 --- a/lib/src/screens/receive/fullscreen_qr_page.dart +++ b/lib/src/screens/receive/fullscreen_qr_page.dart @@ -3,6 +3,7 @@ import 'package:cake_wallet/src/widgets/gradient_background.dart'; import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class FullscreenQRPage extends BasePage { FullscreenQRPage({required this.qrViewData}); @@ -19,10 +20,7 @@ class FullscreenQRPage extends BasePage { Widget leading(BuildContext context) { final _backButton = Icon( Icons.arrow_back_ios, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, size: 16, ); @@ -62,10 +60,7 @@ class FullscreenQRPage extends BasePage { decoration: BoxDecoration( border: Border.all( width: 3, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!)), + color: Theme.of(context).extension()!.textColor)), child: Container( decoration: BoxDecoration( border: Border.all(width: 3, color: Colors.white)), diff --git a/lib/src/screens/receive/widgets/copy_link_item.dart b/lib/src/screens/receive/widgets/copy_link_item.dart index cecf33e6c..7c1ffa874 100644 --- a/lib/src/screens/receive/widgets/copy_link_item.dart +++ b/lib/src/screens/receive/widgets/copy_link_item.dart @@ -5,6 +5,7 @@ import 'package:cake_wallet/utils/show_bar.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:share_plus/share_plus.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class CopyLinkItem extends StatelessWidget { const CopyLinkItem({super.key, required this.url, required this.title}); @@ -14,10 +15,7 @@ class CopyLinkItem extends StatelessWidget { @override Widget build(BuildContext context) { final copyImage = Image.asset('assets/images/copy_address.png', - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!); + color: Theme.of(context).extension()!.textColor); return Row( mainAxisAlignment: MainAxisAlignment.center, @@ -25,10 +23,7 @@ class CopyLinkItem extends StatelessWidget { Text( title, style: textMedium( - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), ), SizedBox(width: 50), @@ -51,10 +46,7 @@ class CopyLinkItem extends StatelessWidget { onPressed: () => Share.share(url), icon: Icon( Icons.share, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), ) ], diff --git a/lib/src/screens/receive/widgets/currency_input_field.dart b/lib/src/screens/receive/widgets/currency_input_field.dart index 85e2cdbe2..de0cc0394 100644 --- a/lib/src/screens/receive/widgets/currency_input_field.dart +++ b/lib/src/screens/receive/widgets/currency_input_field.dart @@ -3,6 +3,7 @@ import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cw_core/currency.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class CurrencyInputField extends StatelessWidget { const CurrencyInputField({ @@ -24,7 +25,7 @@ class CurrencyInputField extends StatelessWidget { Widget build(BuildContext context) { final arrowBottomPurple = Image.asset( 'assets/images/arrow_bottom_purple_icon.png', - color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!, + color: Theme.of(context).extension()!.textColor, height: 8, ); // This magic number for wider screen sets the text input focus at center of the inputfield @@ -50,9 +51,9 @@ class CurrencyInputField extends StatelessWidget { fontWeight: FontWeight.w600, ), borderColor: Theme.of(context).accentTextTheme!.titleLarge!.backgroundColor!, - textColor: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!, + textColor: Theme.of(context).extension()!.textColor, textStyle: TextStyle( - color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), prefixIcon: Padding( padding: EdgeInsets.only( @@ -75,10 +76,7 @@ class CurrencyInputField extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w600, fontSize: 16, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), ), if (selectedCurrency.tag != null) @@ -113,10 +111,7 @@ class CurrencyInputField extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w600, fontSize: 20, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), ), ), diff --git a/lib/src/screens/receive/widgets/qr_widget.dart b/lib/src/screens/receive/widgets/qr_widget.dart index 70a8e48bc..646366925 100644 --- a/lib/src/screens/receive/widgets/qr_widget.dart +++ b/lib/src/screens/receive/widgets/qr_widget.dart @@ -12,6 +12,7 @@ import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart'; import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class QRWidget extends StatelessWidget { QRWidget({ @@ -51,10 +52,7 @@ class QRWidget extends StatelessWidget { style: TextStyle( fontSize: 14, fontWeight: FontWeight.w500, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!), + color: Theme.of(context).extension()!.textColor), ), ), Row( @@ -85,10 +83,7 @@ class QRWidget extends StatelessWidget { decoration: BoxDecoration( border: Border.all( width: 3, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), ), child: Container( @@ -152,10 +147,7 @@ class QRWidget extends StatelessWidget { style: TextStyle( fontSize: 15, fontWeight: FontWeight.w500, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!), + color: Theme.of(context).extension()!.textColor), ), ), Padding( diff --git a/lib/src/screens/release_notes/release_notes_screen.dart b/lib/src/screens/release_notes/release_notes_screen.dart index f97f2c0a0..999abc142 100644 --- a/lib/src/screens/release_notes/release_notes_screen.dart +++ b/lib/src/screens/release_notes/release_notes_screen.dart @@ -1,7 +1,7 @@ import 'dart:convert'; import 'package:cake_wallet/src/widgets/alert_background.dart'; import 'package:cake_wallet/src/widgets/alert_close_button.dart'; -import 'package:cake_wallet/themes/extensions/dashboard_gradient_theme.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; import 'package:cake_wallet/wallet_type_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -34,8 +34,8 @@ class ReleaseNotesScreen extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(30.0), gradient: LinearGradient(colors: [ - Theme.of(context).extension()!.firstGradientColor, - Theme.of(context).extension()!.secondGradientColor, + Theme.of(context).extension()!.firstGradientBackgroundColor, + Theme.of(context).extension()!.secondGradientBackgroundColor, ], begin: Alignment.centerLeft, end: Alignment.centerRight)), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 24.0), @@ -52,10 +52,7 @@ class ReleaseNotesScreen extends StatelessWidget { fontSize: 24.0, fontWeight: FontWeight.bold, fontFamily: 'Lato', - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), child: Text(title), ), @@ -122,10 +119,7 @@ class ReleaseNotesScreen extends StatelessWidget { decoration: TextDecoration.none, fontSize: 16.0, fontFamily: 'Lato', - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/src/screens/yat_emoji_id.dart b/lib/src/screens/yat_emoji_id.dart index 18a213c41..f28f5da0d 100644 --- a/lib/src/screens/yat_emoji_id.dart +++ b/lib/src/screens/yat_emoji_id.dart @@ -13,6 +13,7 @@ import 'package:animate_do/animate_do.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:cake_wallet/generated/i18n.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class YatEmojiId extends StatelessWidget { YatEmojiId(this.emojiId); @@ -90,7 +91,7 @@ class YatEmojiId extends StatelessWidget { fontSize: 32, fontWeight: FontWeight.bold, fontFamily: 'Lato', - color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!, + color: Theme.of(context).extension()!.textColor, decoration: TextDecoration.none, ) ), diff --git a/lib/src/widgets/gradient_background.dart b/lib/src/widgets/gradient_background.dart index e51cd0744..591e24289 100644 --- a/lib/src/widgets/gradient_background.dart +++ b/lib/src/widgets/gradient_background.dart @@ -1,4 +1,4 @@ -import 'package:cake_wallet/themes/extensions/dashboard_gradient_theme.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; import 'package:flutter/material.dart'; class GradientBackground extends StatelessWidget { @@ -13,14 +13,14 @@ class GradientBackground extends StatelessWidget { gradient: LinearGradient( colors: [ Theme.of(context) - .extension()! - .firstGradientColor, + .extension()! + .firstGradientBackgroundColor, Theme.of(context) - .extension()! - .secondGradientColor, + .extension()! + .secondGradientBackgroundColor, Theme.of(context) - .extension()! - .thirdGradientColor, + .extension()! + .thirdGradientBackgroundColor, ], begin: Alignment.topRight, end: Alignment.bottomLeft, diff --git a/lib/src/widgets/introducing_card.dart b/lib/src/widgets/introducing_card.dart index 756a7648d..f962402e1 100644 --- a/lib/src/widgets/introducing_card.dart +++ b/lib/src/widgets/introducing_card.dart @@ -2,6 +2,7 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/palette.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class IntroducingCard extends StatelessWidget { IntroducingCard( @@ -45,10 +46,7 @@ class IntroducingCard extends StatelessWidget { fontSize: 24, fontFamily: 'Lato', fontWeight: FontWeight.bold, - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, height: 1), maxLines: 1, textAlign: TextAlign.center), @@ -58,10 +56,7 @@ class IntroducingCard extends StatelessWidget { style: TextStyle( fontSize: 12, fontFamily: 'Lato', - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, height: 1)), ], ), diff --git a/lib/src/widgets/market_place_item.dart b/lib/src/widgets/market_place_item.dart index 1d830ca68..b41304eec 100644 --- a/lib/src/widgets/market_place_item.dart +++ b/lib/src/widgets/market_place_item.dart @@ -1,5 +1,6 @@ import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart'; import 'package:flutter/material.dart'; +import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; class MarketPlaceItem extends StatelessWidget { @@ -40,10 +41,7 @@ class MarketPlaceItem extends StatelessWidget { Text( title, style: TextStyle( - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, fontSize: 24, fontWeight: FontWeight.w900, ), @@ -52,10 +50,7 @@ class MarketPlaceItem extends StatelessWidget { Text( subTitle, style: TextStyle( - color: Theme.of(context) - .accentTextTheme! - .displayMedium! - .backgroundColor!, + color: Theme.of(context).extension()!.textColor, fontWeight: FontWeight.w500, fontFamily: 'Lato'), ) diff --git a/lib/themes/bright_theme.dart b/lib/themes/bright_theme.dart index 707fef049..8f83e86c7 100644 --- a/lib/themes/bright_theme.dart +++ b/lib/themes/bright_theme.dart @@ -1,4 +1,4 @@ -import 'package:cake_wallet/themes/extensions/dashboard_gradient_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/sync_indicator_theme.dart'; import 'package:cake_wallet/themes/light_theme.dart'; @@ -20,10 +20,11 @@ class BrightTheme extends LightTheme { Color get containerColor => Palette.moderateLavender; @override - DashboardGradientTheme get pageGradientTheme => DashboardGradientTheme( - firstGradientColor: Palette.blueCraiola, - secondGradientColor: Palette.pinkFlamingo, - thirdGradientColor: Palette.redHat); + DashboardPageTheme get pageGradientTheme => super.pageGradientTheme.copyWith( + firstGradientBackgroundColor: Palette.blueCraiola, + secondGradientBackgroundColor: Palette.pinkFlamingo, + thirdGradientBackgroundColor: Palette.redHat, + textColor: Colors.white); @override SyncIndicatorTheme get syncIndicatorStyle => @@ -210,8 +211,6 @@ class BrightTheme extends LightTheme { color: Palette.darkGray, // hint text (new wallet page) decorationColor: Palette.periwinkleCraiola, // underline (new wallet page) - backgroundColor: - Colors.white // menu, icons, balance (dashboard page) ), )); } diff --git a/lib/themes/dark_theme.dart b/lib/themes/dark_theme.dart index 682799807..95b331966 100644 --- a/lib/themes/dark_theme.dart +++ b/lib/themes/dark_theme.dart @@ -245,8 +245,6 @@ class DarkTheme extends ThemeBase { color: PaletteDark.cyanBlue, // hint text (new wallet page) decorationColor: PaletteDark.darkGrey, // underline (new wallet page) - backgroundColor: - Colors.white // menu, icons, balance (dashboard page) ), ), ); diff --git a/lib/themes/extensions/dashboard_gradient_theme.dart b/lib/themes/extensions/dashboard_gradient_theme.dart deleted file mode 100644 index da4f331ed..000000000 --- a/lib/themes/extensions/dashboard_gradient_theme.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:flutter/material.dart'; - -class DashboardGradientTheme extends ThemeExtension { - final Color firstGradientColor; - final Color secondGradientColor; - final Color thirdGradientColor; - - DashboardGradientTheme( - {required this.firstGradientColor, - required this.secondGradientColor, - required this.thirdGradientColor}); - - @override - Object get type => DashboardGradientTheme; - - @override - DashboardGradientTheme copyWith( - {Color? firstGradientColor, - Color? secondGradientColor, - Color? thirdGradientColor}) => - DashboardGradientTheme( - firstGradientColor: firstGradientColor ?? this.firstGradientColor, - secondGradientColor: secondGradientColor ?? this.secondGradientColor, - thirdGradientColor: thirdGradientColor ?? this.thirdGradientColor); - - @override - DashboardGradientTheme lerp(ThemeExtension? other, double t) { - if (other is! DashboardGradientTheme) { - return this; - } - - return DashboardGradientTheme( - firstGradientColor: - Color.lerp(firstGradientColor, other.firstGradientColor, t)!, - secondGradientColor: - Color.lerp(secondGradientColor, other.secondGradientColor, t)!, - thirdGradientColor: - Color.lerp(thirdGradientColor, other.thirdGradientColor, t)!); - } -} - diff --git a/lib/themes/extensions/dashboard_page_theme.dart b/lib/themes/extensions/dashboard_page_theme.dart new file mode 100644 index 000000000..783f7635a --- /dev/null +++ b/lib/themes/extensions/dashboard_page_theme.dart @@ -0,0 +1,51 @@ +import 'package:flutter/material.dart'; + +class DashboardPageTheme extends ThemeExtension { + final Color firstGradientBackgroundColor; + final Color secondGradientBackgroundColor; + final Color thirdGradientBackgroundColor; + final Color textColor; + + DashboardPageTheme( + {required this.firstGradientBackgroundColor, + required this.secondGradientBackgroundColor, + required this.thirdGradientBackgroundColor, + required this.textColor}); + + @override + Object get type => DashboardPageTheme; + + @override + DashboardPageTheme copyWith( + {Color? firstGradientBackgroundColor, + Color? secondGradientBackgroundColor, + Color? thirdGradientBackgroundColor, + Color? textColor}) => + DashboardPageTheme( + firstGradientBackgroundColor: + firstGradientBackgroundColor ?? this.firstGradientBackgroundColor, + secondGradientBackgroundColor: secondGradientBackgroundColor ?? + this.secondGradientBackgroundColor, + thirdGradientBackgroundColor: + thirdGradientBackgroundColor ?? this.thirdGradientBackgroundColor, + textColor: textColor ?? this.textColor); + + @override + DashboardPageTheme lerp(ThemeExtension? other, double t) { + if (other is! DashboardPageTheme) { + return this; + } + + return DashboardPageTheme( + firstGradientBackgroundColor: Color.lerp(firstGradientBackgroundColor, + other.firstGradientBackgroundColor, t) ?? + firstGradientBackgroundColor, + secondGradientBackgroundColor: Color.lerp(secondGradientBackgroundColor, + other.secondGradientBackgroundColor, t) ?? + secondGradientBackgroundColor, + thirdGradientBackgroundColor: Color.lerp(thirdGradientBackgroundColor, + other.thirdGradientBackgroundColor, t) ?? + thirdGradientBackgroundColor, + textColor: Color.lerp(textColor, other.textColor, t) ?? textColor); + } +} diff --git a/lib/themes/light_theme.dart b/lib/themes/light_theme.dart index 4cdfb2e20..e3a40250f 100644 --- a/lib/themes/light_theme.dart +++ b/lib/themes/light_theme.dart @@ -242,8 +242,6 @@ class LightTheme extends ThemeBase { color: Palette.darkGray, // hint text (new wallet page) decorationColor: Palette.periwinkleCraiola, // underline (new wallet page) - backgroundColor: - Palette.darkBlueCraiola // menu, icons, balance (dashboard page) ), ), ); diff --git a/lib/themes/theme_base.dart b/lib/themes/theme_base.dart index 421d95a89..dde274319 100644 --- a/lib/themes/theme_base.dart +++ b/lib/themes/theme_base.dart @@ -1,5 +1,5 @@ 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_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/pin_code_theme.dart'; @@ -37,10 +37,11 @@ abstract class ThemeBase { colorScheme: colorScheme, textTheme: TextTheme().apply(fontFamily: 'Lato')); - DashboardGradientTheme get pageGradientTheme => DashboardGradientTheme( - firstGradientColor: backgroundColor, - secondGradientColor: backgroundColor, - thirdGradientColor: backgroundColor); + DashboardPageTheme get pageGradientTheme => DashboardPageTheme( + firstGradientBackgroundColor: backgroundColor, + secondGradientBackgroundColor: backgroundColor, + thirdGradientBackgroundColor: backgroundColor, + textColor: primaryTextColor); CakeScrollbarTheme get scrollbarTheme;