mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-11 05:14:46 +00:00
refactor: primaryTextTheme.bodyLarge.backgroundColor -> AlertTheme.leftButtonTextColor
This commit is contained in:
parent
5ba89213c1
commit
85a30d1d81
6 changed files with 40 additions and 16 deletions
|
@ -1,5 +1,6 @@
|
|||
import 'dart:ui';
|
||||
import 'package:cake_wallet/src/widgets/section_divider.dart';
|
||||
import 'package:cake_wallet/themes/extensions/alert_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
|
@ -68,10 +69,7 @@ class BaseAlertDialog extends StatelessWidget {
|
|||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: leftActionButtonTextColor ??
|
||||
Theme.of(context)
|
||||
.primaryTextTheme!
|
||||
.bodyLarge!
|
||||
.backgroundColor!,
|
||||
Theme.of(context).extension<AlertTheme>()!.leftButtonTextColor,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)),
|
||||
|
|
|
@ -175,9 +175,6 @@ class BrightTheme extends LightTheme {
|
|||
color: Palette.darkBlueCraiola, // template title (send page)
|
||||
backgroundColor: Colors.white, // icon color on order row (moonpay)
|
||||
),
|
||||
// body2 -> bodyLarge
|
||||
bodyLarge: TextStyle(
|
||||
backgroundColor: Palette.brightOrange // alert left button text
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
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/dashboard_page_theme.dart';
|
||||
|
@ -127,6 +128,10 @@ class DarkTheme extends ThemeBase {
|
|||
PickerTheme get pickerTheme =>
|
||||
PickerTheme(dividerColor: PaletteDark.dividerColor);
|
||||
|
||||
@override
|
||||
AlertTheme get alertTheme =>
|
||||
AlertTheme(leftButtonTextColor: Palette.alizarinRed);
|
||||
|
||||
@override
|
||||
ThemeData get themeData => super.themeData.copyWith(
|
||||
indicatorColor: PaletteDark.cyanBlue, // page indicator
|
||||
|
@ -232,10 +237,6 @@ class DarkTheme extends ThemeBase {
|
|||
backgroundColor:
|
||||
Colors.white, // icon color on order row (moonpay)
|
||||
),
|
||||
// body2 -> bodyLarge
|
||||
bodyLarge: TextStyle(
|
||||
backgroundColor: Palette.alizarinRed // alert left button text
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
23
lib/themes/extensions/alert_theme.dart
Normal file
23
lib/themes/extensions/alert_theme.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class AlertTheme extends ThemeExtension<AlertTheme> {
|
||||
final Color leftButtonTextColor;
|
||||
|
||||
AlertTheme({required this.leftButtonTextColor});
|
||||
|
||||
@override
|
||||
AlertTheme copyWith({Color? leftButtonTextColor}) => AlertTheme(
|
||||
leftButtonTextColor: leftButtonTextColor ?? this.leftButtonTextColor);
|
||||
|
||||
@override
|
||||
AlertTheme lerp(ThemeExtension<AlertTheme>? other, double t) {
|
||||
if (other is! AlertTheme) {
|
||||
return this;
|
||||
}
|
||||
|
||||
return AlertTheme(
|
||||
leftButtonTextColor:
|
||||
Color.lerp(leftButtonTextColor, other.leftButtonTextColor, t) ??
|
||||
leftButtonTextColor);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
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/dashboard_page_theme.dart';
|
||||
|
@ -128,6 +129,10 @@ class LightTheme extends ThemeBase {
|
|||
PickerTheme get pickerTheme =>
|
||||
PickerTheme(dividerColor: Palette.periwinkleCraiola);
|
||||
|
||||
@override
|
||||
AlertTheme get alertTheme =>
|
||||
AlertTheme(leftButtonTextColor: Palette.brightOrange);
|
||||
|
||||
@override
|
||||
ThemeData get themeData => super.themeData.copyWith(
|
||||
indicatorColor:
|
||||
|
@ -233,10 +238,6 @@ class LightTheme extends ThemeBase {
|
|||
backgroundColor:
|
||||
Colors.black, // icon color on order row (moonpay)
|
||||
),
|
||||
// body2 -> bodyLarge
|
||||
bodyLarge: TextStyle(
|
||||
backgroundColor: Palette.brightOrange // alert left button text
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
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/dashboard_page_theme.dart';
|
||||
|
@ -79,6 +80,8 @@ abstract class ThemeBase {
|
|||
|
||||
PickerTheme get pickerTheme;
|
||||
|
||||
AlertTheme get alertTheme;
|
||||
|
||||
ThemeData get themeData => generatedThemeData.copyWith(
|
||||
primaryColor: primaryColor,
|
||||
cardColor: containerColor,
|
||||
|
@ -99,6 +102,7 @@ abstract class ThemeBase {
|
|||
walletListTheme,
|
||||
infoTheme,
|
||||
pickerTheme,
|
||||
alertTheme,
|
||||
],
|
||||
scrollbarTheme: ScrollbarThemeData(
|
||||
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),
|
||||
|
|
Loading…
Reference in a new issue