feat: add backdropColor to alert and picker backdrop filters

This commit is contained in:
Rafael Saes 2023-07-07 17:25:22 -03:00
parent cec4ed1e0b
commit 17525c5bcc
9 changed files with 47 additions and 27 deletions

View file

@ -1,7 +1,6 @@
import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
@ -148,7 +147,7 @@ class BalancePage extends StatelessWidget {
fontSize: 16,
fontFamily: 'Lato',
fontWeight: FontWeight.w500,
color: Theme.of(context).extension<BalancePageTheme>()!.assetTitleColor,
color: Theme.of(context).extension<BalancePageTheme>()!.textColor,
height: 1)),
],
@ -159,8 +158,7 @@ class BalancePage extends StatelessWidget {
fontSize: 28,
fontFamily: 'Lato',
fontWeight: FontWeight.w800,
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
height: 1)),
color: Theme.of(context).extension<BalancePageTheme>()!.assetTitleColor)),
],
),
SizedBox(height: 26),

View file

@ -1,7 +1,7 @@
import 'dart:ui';
import 'package:cake_wallet/themes/extensions/alert_theme.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class AlertBackground extends StatelessWidget {
AlertBackground({required this.child});
@ -20,7 +20,9 @@ class AlertBackground extends StatelessWidget {
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
child: Container(
decoration: BoxDecoration(color: PaletteDark.darkNightBlue.withOpacity(0.75)),
decoration: BoxDecoration(
color:
Theme.of(context).extension<AlertTheme>()!.backdropColor),
child: Center(
child: Container(
width: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint,

View file

@ -110,7 +110,9 @@ class BaseAlertDialog extends StatelessWidget {
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
child: Container(
decoration: BoxDecoration(color: PaletteDark.darkNightBlue.withOpacity(0.75)),
decoration: BoxDecoration(
color:
Theme.of(context).extension<AlertTheme>()!.backdropColor),
child: Center(
child: GestureDetector(
onTap: () => null,

View file

@ -142,8 +142,9 @@ class DarkTheme extends ThemeBase {
PickerTheme(dividerColor: PaletteDark.dividerColor);
@override
AlertTheme get alertTheme =>
AlertTheme(leftButtonTextColor: Palette.alizarinRed);
AlertTheme get alertTheme => AlertTheme(
backdropColor: PaletteDark.darkNightBlue.withOpacity(0.75),
leftButtonTextColor: Palette.alizarinRed);
@override
OrderTheme get orderTheme => OrderTheme(iconColor: Colors.white);

View file

@ -2,12 +2,15 @@ import 'package:flutter/material.dart';
class AlertTheme extends ThemeExtension<AlertTheme> {
final Color leftButtonTextColor;
final Color backdropColor;
AlertTheme({required this.leftButtonTextColor});
AlertTheme({required this.leftButtonTextColor, required this.backdropColor});
@override
AlertTheme copyWith({Color? leftButtonTextColor}) => AlertTheme(
leftButtonTextColor: leftButtonTextColor ?? this.leftButtonTextColor);
AlertTheme copyWith({Color? leftButtonTextColor, Color? backdropColor}) =>
AlertTheme(
leftButtonTextColor: leftButtonTextColor ?? this.leftButtonTextColor,
backdropColor: backdropColor ?? this.backdropColor);
@override
AlertTheme lerp(ThemeExtension<AlertTheme>? other, double t) {
@ -18,6 +21,8 @@ class AlertTheme extends ThemeExtension<AlertTheme> {
return AlertTheme(
leftButtonTextColor:
Color.lerp(leftButtonTextColor, other.leftButtonTextColor, t) ??
leftButtonTextColor);
leftButtonTextColor,
backdropColor:
Color.lerp(backdropColor, other.backdropColor, t) ?? backdropColor);
}
}

View file

@ -8,7 +8,14 @@ import 'package:cake_wallet/themes/monero_light_theme.dart';
import 'package:flutter/material.dart';
class HighContrastTheme extends MoneroLightTheme {
HighContrastTheme({required int raw}) : super(raw: raw);
HighContrastTheme({required int raw}) : super(raw: raw) {
colorScheme = ColorScheme.fromSwatch(
primarySwatch: Colors.grey,
accentColor: primaryColor,
backgroundColor: Colors.white,
cardColor: containerColor,
brightness: Brightness.light);
}
@override
String get title => S.current.high_contrast_theme;
@ -17,14 +24,6 @@ class HighContrastTheme extends MoneroLightTheme {
@override
Color get containerColor => Palette.highContrastGray;
@override
ColorScheme get colorScheme => ColorScheme.fromSwatch(
primarySwatch: Colors.grey,
accentColor: primaryColor,
backgroundColor: Colors.white,
cardColor: containerColor,
brightness: Brightness.light);
@override
Color get primaryTextColor => colorScheme.onBackground;

View file

@ -142,8 +142,9 @@ class LightTheme extends ThemeBase {
PickerTheme(dividerColor: Palette.periwinkleCraiola);
@override
AlertTheme get alertTheme =>
AlertTheme(leftButtonTextColor: Palette.brightOrange);
AlertTheme get alertTheme => AlertTheme(
backdropColor: PaletteDark.darkNightBlue.withOpacity(0.75),
leftButtonTextColor: Palette.brightOrange);
@override
OrderTheme get orderTheme => OrderTheme(iconColor: Colors.black);

View file

@ -1,6 +1,7 @@
import 'package:cake_wallet/themes/dark_theme.dart';
import 'package:cake_wallet/themes/extensions/account_list_theme.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
import 'package:cake_wallet/themes/extensions/alert_theme.dart';
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
@ -141,9 +142,9 @@ class MoneroDarkTheme extends DarkTheme {
super.seedWidgetTheme.copyWith(hintTextColor: Colors.grey);
@override
TransactionTradeTheme get transactionTradeTheme =>
super.transactionTradeTheme.copyWith(
detailsTitlesColor: Colors.grey, rowsColor: containerColor);
TransactionTradeTheme get transactionTradeTheme => super
.transactionTradeTheme
.copyWith(detailsTitlesColor: Colors.grey, rowsColor: containerColor);
@override
CakeTextTheme get cakeTextTheme => super.cakeTextTheme.copyWith(
@ -170,6 +171,11 @@ class MoneroDarkTheme extends DarkTheme {
QRCodeTheme get qrCodeTheme => QRCodeTheme(
qrCodeColor: Colors.grey, qrWidgetCopyButtonColor: Colors.grey);
@override
AlertTheme get alertTheme => super
.alertTheme
.copyWith(backdropColor: colorScheme.surface.withOpacity(0.75));
@override
ThemeData get themeData => super.themeData.copyWith(
dividerColor: pickerTheme.dividerColor,

View file

@ -1,5 +1,6 @@
import 'package:cake_wallet/themes/extensions/account_list_theme.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
import 'package:cake_wallet/themes/extensions/alert_theme.dart';
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
@ -142,6 +143,11 @@ class MoneroLightTheme extends LightTheme {
.qrCodeTheme
.copyWith(qrWidgetCopyButtonColor: colorScheme.secondary);
@override
AlertTheme get alertTheme => super
.alertTheme
.copyWith(backdropColor: colorScheme.inverseSurface.withOpacity(0.75));
@override
ThemeData get themeData => super.themeData.copyWith(
dividerColor: pickerTheme.dividerColor,