diff --git a/lib/src/screens/exchange/widgets/exchange_card.dart b/lib/src/screens/exchange/widgets/exchange_card.dart index d73249fe1..385e8d8e6 100644 --- a/lib/src/screens/exchange/widgets/exchange_card.dart +++ b/lib/src/screens/exchange/widgets/exchange_card.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/entities/contact_base.dart'; +import 'package:cake_wallet/themes/extensions/qr_code_theme.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart'; @@ -177,7 +178,7 @@ class ExchangeCardState extends State { style: TextStyle( fontSize: 18, fontWeight: FontWeight.w600, - color: Theme.of(context).textTheme!.headlineSmall!.color!), + color: Theme.of(context).extension()!.qrCodeColor), ) ], ), diff --git a/lib/src/screens/exchange/widgets/present_provider_picker.dart b/lib/src/screens/exchange/widgets/present_provider_picker.dart index 20d3bf70c..75429aea9 100644 --- a/lib/src/screens/exchange/widgets/present_provider_picker.dart +++ b/lib/src/screens/exchange/widgets/present_provider_picker.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; +import 'package:cake_wallet/themes/extensions/qr_code_theme.dart'; import 'package:cake_wallet/src/widgets/check_box_picker.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; @@ -49,10 +50,7 @@ class PresentProviderPicker extends StatelessWidget { style: TextStyle( fontSize: 10.0, fontWeight: FontWeight.w500, - color: Theme.of(context) - .textTheme! - .headlineSmall! - .color!))) + color: Theme.of(context).extension()!.qrCodeColor))) ], ), SizedBox(width: 5), diff --git a/lib/src/screens/receive/anonpay_receive_page.dart b/lib/src/screens/receive/anonpay_receive_page.dart index acb2d9061..9f50633bb 100644 --- a/lib/src/screens/receive/anonpay_receive_page.dart +++ b/lib/src/screens/receive/anonpay_receive_page.dart @@ -9,6 +9,7 @@ import 'package:cake_wallet/src/widgets/gradient_background.dart'; import 'package:cake_wallet/src/screens/receive/widgets/anonpay_status_section.dart'; import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart'; import 'package:cake_wallet/src/screens/receive/widgets/copy_link_item.dart'; +import 'package:cake_wallet/themes/extensions/qr_code_theme.dart'; import 'package:device_display_brightness/device_display_brightness.dart'; import 'package:flutter/material.dart'; import 'package:qr_flutter/qr_flutter.dart' as qr; @@ -68,7 +69,7 @@ class AnonPayReceivePage extends BasePage { style: TextStyle( fontSize: 10.0, fontWeight: FontWeight.w500, - color: Theme.of(context).textTheme!.headlineSmall!.color!), + color: Theme.of(context).extension()!.qrCodeColor), ) ], ); diff --git a/lib/src/screens/receive/widgets/qr_widget.dart b/lib/src/screens/receive/widgets/qr_widget.dart index 646366925..0d2a7c80d 100644 --- a/lib/src/screens/receive/widgets/qr_widget.dart +++ b/lib/src/screens/receive/widgets/qr_widget.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/entities/qr_view_data.dart'; +import 'package:cake_wallet/themes/extensions/qr_code_theme.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker.dart'; import 'package:cake_wallet/src/screens/receive/widgets/currency_input_field.dart'; @@ -36,7 +37,7 @@ class QRWidget extends StatelessWidget { @override Widget build(BuildContext context) { final copyImage = Image.asset('assets/images/copy_address.png', - color: Theme.of(context).textTheme!.titleMedium!.decorationColor!); + color: Theme.of(context).extension()!.qrWidgetCopyButtonColor); return Column( mainAxisSize: MainAxisSize.min, diff --git a/lib/themes/bright_theme.dart b/lib/themes/bright_theme.dart index c1f6292f8..9891d3b06 100644 --- a/lib/themes/bright_theme.dart +++ b/lib/themes/bright_theme.dart @@ -105,6 +105,11 @@ class BrightTheme extends LightTheme { amountHintTextColor: Colors.white, ); + @override + QRCodeTheme get qrCodeTheme => super + .qrCodeTheme + .copyWith(qrWidgetCopyButtonColor: Colors.white.withOpacity(0.4)); + @override ThemeData get themeData => super.themeData.copyWith( indicatorColor: Colors.white.withOpacity(0.5), // page indicator @@ -121,10 +126,6 @@ class BrightTheme extends LightTheme { decorationColor: Colors.white.withOpacity(0.4), // copy button (qr widget) ), - // headline -> headlineSmall - headlineSmall: TextStyle( - color: Colors.white, // qr code - ), ), ); } diff --git a/lib/themes/dark_theme.dart b/lib/themes/dark_theme.dart index 63957b70e..98effdc18 100644 --- a/lib/themes/dark_theme.dart +++ b/lib/themes/dark_theme.dart @@ -189,6 +189,11 @@ class DarkTheme extends ThemeBase { amountBottomBorderColor: PaletteDark.darkGrey, amountHintTextColor: PaletteDark.cyanBlue); + @override + QRCodeTheme get qrCodeTheme => QRCodeTheme( + qrCodeColor: PaletteDark.lightBlueGrey, + qrWidgetCopyButtonColor: PaletteDark.lightBlueGrey); + @override ThemeData get themeData => super.themeData.copyWith( indicatorColor: PaletteDark.cyanBlue, // page indicator @@ -206,11 +211,6 @@ class DarkTheme extends ThemeBase { // subhead -> titleMedium titleMedium: TextStyle( color: PaletteDark.nightBlue, // address button border - decorationColor: PaletteDark.lightBlueGrey, // copy button (qr widget) - ), - // headline -> headlineSmall - headlineSmall: TextStyle( - color: PaletteDark.lightBlueGrey, // qr code ), ), ); diff --git a/lib/themes/extensions/qr_code_theme.dart b/lib/themes/extensions/qr_code_theme.dart new file mode 100644 index 000000000..7b6554553 --- /dev/null +++ b/lib/themes/extensions/qr_code_theme.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; + +class QRCodeTheme extends ThemeExtension { + final Color qrCodeColor; + final Color qrWidgetCopyButtonColor; + + QRCodeTheme( + {required this.qrCodeColor, required this.qrWidgetCopyButtonColor}); + + @override + QRCodeTheme copyWith({Color? qrCodeColor, Color? qrWidgetCopyButtonColor}) => + QRCodeTheme( + qrCodeColor: qrCodeColor ?? this.qrCodeColor, + qrWidgetCopyButtonColor: + qrWidgetCopyButtonColor ?? this.qrWidgetCopyButtonColor); + + @override + QRCodeTheme lerp(ThemeExtension? other, double t) { + if (other is! QRCodeTheme) { + return this; + } + + return QRCodeTheme( + qrCodeColor: Color.lerp(qrCodeColor, other.qrCodeColor, t)!, + qrWidgetCopyButtonColor: Color.lerp( + qrWidgetCopyButtonColor, other.qrWidgetCopyButtonColor, t)!); + } +} diff --git a/lib/themes/light_theme.dart b/lib/themes/light_theme.dart index 75a9de85a..d299fc184 100644 --- a/lib/themes/light_theme.dart +++ b/lib/themes/light_theme.dart @@ -191,6 +191,11 @@ class LightTheme extends ThemeBase { amountBottomBorderColor: Palette.darkBlueCraiola, amountHintTextColor: Palette.darkBlueCraiola); + @override + QRCodeTheme get qrCodeTheme => QRCodeTheme( + qrCodeColor: Colors.white, + qrWidgetCopyButtonColor: PaletteDark.lightBlueGrey); + @override ThemeData get themeData => super.themeData.copyWith( indicatorColor: @@ -209,11 +214,6 @@ class LightTheme extends ThemeBase { // subhead -> titleMedium titleMedium: TextStyle( color: Palette.blueAlice, // address button border - decorationColor: PaletteDark.lightBlueGrey, // copy button (qr widget) - ), - // headline -> headlineSmall - headlineSmall: TextStyle( - color: Colors.white, // qr code ), ), ); diff --git a/lib/themes/theme_base.dart b/lib/themes/theme_base.dart index 97919e631..75fd9e501 100644 --- a/lib/themes/theme_base.dart +++ b/lib/themes/theme_base.dart @@ -104,6 +104,8 @@ abstract class ThemeBase { ReceivePageTheme get receivePageTheme; + QRCodeTheme get qrCodeTheme; + ThemeData get themeData => generatedThemeData.copyWith( primaryColor: primaryColor, cardColor: containerColor, @@ -133,6 +135,7 @@ abstract class ThemeBase { cakeTextTheme, accountListTheme, receivePageTheme, + qrCodeTheme, ], scrollbarTheme: ScrollbarThemeData( thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),