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 'dart:ui';
|
||||||
import 'package:cake_wallet/src/widgets/section_divider.dart';
|
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:flutter/material.dart';
|
||||||
import 'package:cake_wallet/palette.dart';
|
import 'package:cake_wallet/palette.dart';
|
||||||
|
|
||||||
|
@ -68,10 +69,7 @@ class BaseAlertDialog extends StatelessWidget {
|
||||||
fontFamily: 'Lato',
|
fontFamily: 'Lato',
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: leftActionButtonTextColor ??
|
color: leftActionButtonTextColor ??
|
||||||
Theme.of(context)
|
Theme.of(context).extension<AlertTheme>()!.leftButtonTextColor,
|
||||||
.primaryTextTheme!
|
|
||||||
.bodyLarge!
|
|
||||||
.backgroundColor!,
|
|
||||||
decoration: TextDecoration.none,
|
decoration: TextDecoration.none,
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
|
|
@ -175,9 +175,6 @@ class BrightTheme extends LightTheme {
|
||||||
color: Palette.darkBlueCraiola, // template title (send page)
|
color: Palette.darkBlueCraiola, // template title (send page)
|
||||||
backgroundColor: Colors.white, // icon color on order row (moonpay)
|
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/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/balance_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
|
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||||
|
@ -127,6 +128,10 @@ class DarkTheme extends ThemeBase {
|
||||||
PickerTheme get pickerTheme =>
|
PickerTheme get pickerTheme =>
|
||||||
PickerTheme(dividerColor: PaletteDark.dividerColor);
|
PickerTheme(dividerColor: PaletteDark.dividerColor);
|
||||||
|
|
||||||
|
@override
|
||||||
|
AlertTheme get alertTheme =>
|
||||||
|
AlertTheme(leftButtonTextColor: Palette.alizarinRed);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeData get themeData => super.themeData.copyWith(
|
ThemeData get themeData => super.themeData.copyWith(
|
||||||
indicatorColor: PaletteDark.cyanBlue, // page indicator
|
indicatorColor: PaletteDark.cyanBlue, // page indicator
|
||||||
|
@ -232,10 +237,6 @@ class DarkTheme extends ThemeBase {
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Colors.white, // icon color on order row (moonpay)
|
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/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/balance_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
|
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||||
|
@ -128,6 +129,10 @@ class LightTheme extends ThemeBase {
|
||||||
PickerTheme get pickerTheme =>
|
PickerTheme get pickerTheme =>
|
||||||
PickerTheme(dividerColor: Palette.periwinkleCraiola);
|
PickerTheme(dividerColor: Palette.periwinkleCraiola);
|
||||||
|
|
||||||
|
@override
|
||||||
|
AlertTheme get alertTheme =>
|
||||||
|
AlertTheme(leftButtonTextColor: Palette.brightOrange);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeData get themeData => super.themeData.copyWith(
|
ThemeData get themeData => super.themeData.copyWith(
|
||||||
indicatorColor:
|
indicatorColor:
|
||||||
|
@ -233,10 +238,6 @@ class LightTheme extends ThemeBase {
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Colors.black, // icon color on order row (moonpay)
|
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/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/balance_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
|
import 'package:cake_wallet/themes/extensions/cake_scrollbar_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||||
|
@ -79,6 +80,8 @@ abstract class ThemeBase {
|
||||||
|
|
||||||
PickerTheme get pickerTheme;
|
PickerTheme get pickerTheme;
|
||||||
|
|
||||||
|
AlertTheme get alertTheme;
|
||||||
|
|
||||||
ThemeData get themeData => generatedThemeData.copyWith(
|
ThemeData get themeData => generatedThemeData.copyWith(
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
cardColor: containerColor,
|
cardColor: containerColor,
|
||||||
|
@ -99,6 +102,7 @@ abstract class ThemeBase {
|
||||||
walletListTheme,
|
walletListTheme,
|
||||||
infoTheme,
|
infoTheme,
|
||||||
pickerTheme,
|
pickerTheme,
|
||||||
|
alertTheme,
|
||||||
],
|
],
|
||||||
scrollbarTheme: ScrollbarThemeData(
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),
|
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),
|
||||||
|
|
Loading…
Reference in a new issue