refactor: primaryTextTheme.labelSmall.decorationColor -> PlaceholderTheme.color

This commit is contained in:
Rafael Saes 2023-07-05 09:29:32 -03:00
parent e49c4ea9a8
commit 94b574b2da
6 changed files with 40 additions and 7 deletions

View file

@ -1,5 +1,6 @@
import 'package:cake_wallet/src/screens/dashboard/widgets/anonpay_transaction_row.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/order_row.dart';
import 'package:cake_wallet/themes/extensions/placeholder_theme.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cake_wallet/view_model/dashboard/anonpay_transaction_list_item.dart';
import 'package:cake_wallet/view_model/dashboard/order_list_item.dart';
@ -136,10 +137,7 @@ class TransactionsPage extends StatelessWidget {
S.of(context).placeholder_transactions,
style: TextStyle(
fontSize: 14,
color: Theme.of(context)
.primaryTextTheme
.labelSmall!
.decorationColor!),
color: Theme.of(context).extension<PlaceholderTheme>()!.color),
),
);
}))

View file

@ -6,6 +6,7 @@ import 'package:cake_wallet/themes/extensions/indicator_dot_theme.dart';
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
import 'package:cake_wallet/themes/extensions/order_theme.dart';
import 'package:cake_wallet/themes/extensions/placeholder_theme.dart';
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart';
@ -85,6 +86,10 @@ class BrightTheme extends LightTheme {
templateDotterBorderColor: Palette.shadowWhite,
secondGradientColor: Palette.pinkFlamingo);
@override
PlaceholderTheme get placeholderTheme =>
PlaceholderTheme(color: Colors.white.withOpacity(0.5));
@override
ThemeData get themeData => super.themeData.copyWith(
indicatorColor: Colors.white.withOpacity(0.5), // page indicator
@ -147,7 +152,6 @@ class BrightTheme extends LightTheme {
),
labelSmall: TextStyle(
color: Palette.darkGray, // transaction/trade details titles
decorationColor: Colors.white.withOpacity(0.5), // placeholder
),
),
);

View file

@ -13,6 +13,7 @@ import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
import 'package:cake_wallet/themes/extensions/order_theme.dart';
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
import 'package:cake_wallet/themes/extensions/placeholder_theme.dart';
import 'package:cake_wallet/themes/extensions/seed_widget_theme.dart';
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
@ -156,6 +157,9 @@ class DarkTheme extends ThemeBase {
SeedWidgetTheme get seedWidgetTheme =>
SeedWidgetTheme(hintTextColor: PaletteDark.darkCyanBlue);
@override
PlaceholderTheme get placeholderTheme => PlaceholderTheme(color: Colors.grey);
@override
ThemeData get themeData => super.themeData.copyWith(
indicatorColor: PaletteDark.cyanBlue, // page indicator
@ -220,7 +224,6 @@ class DarkTheme extends ThemeBase {
labelSmall: TextStyle(
color:
PaletteDark.lightBlueGrey, // transaction/trade details titles
decorationColor: Colors.grey, // placeholder
),
),
);

View file

@ -0,0 +1,20 @@
import 'package:flutter/material.dart';
class PlaceholderTheme extends ThemeExtension<PlaceholderTheme> {
final Color color;
PlaceholderTheme({required this.color});
@override
PlaceholderTheme copyWith({Color? color}) =>
PlaceholderTheme(color: color ?? this.color);
@override
PlaceholderTheme lerp(ThemeExtension<PlaceholderTheme>? other, double t) {
if (other is! PlaceholderTheme) {
return this;
}
return PlaceholderTheme(color: Color.lerp(color, other.color, t) ?? color);
}
}

View file

@ -13,6 +13,7 @@ import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
import 'package:cake_wallet/themes/extensions/order_theme.dart';
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
import 'package:cake_wallet/themes/extensions/placeholder_theme.dart';
import 'package:cake_wallet/themes/extensions/seed_widget_theme.dart';
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
@ -157,6 +158,10 @@ class LightTheme extends ThemeBase {
SeedWidgetTheme get seedWidgetTheme =>
SeedWidgetTheme(hintTextColor: Palette.darkGray);
@override
PlaceholderTheme get placeholderTheme =>
PlaceholderTheme(color: PaletteDark.darkCyanBlue);
@override
ThemeData get themeData => super.themeData.copyWith(
indicatorColor:
@ -222,7 +227,6 @@ class LightTheme extends ThemeBase {
),
labelSmall: TextStyle(
color: Palette.darkGray, // transaction/trade details titles
decorationColor: PaletteDark.darkCyanBlue, // placeholder
),
),
);

View file

@ -12,6 +12,7 @@ import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
import 'package:cake_wallet/themes/extensions/order_theme.dart';
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
import 'package:cake_wallet/themes/extensions/placeholder_theme.dart';
import 'package:cake_wallet/themes/extensions/seed_widget_theme.dart';
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
import 'package:cake_wallet/themes/extensions/support_page_theme.dart';
@ -91,6 +92,8 @@ abstract class ThemeBase {
SeedWidgetTheme get seedWidgetTheme;
PlaceholderTheme get placeholderTheme;
ThemeData get themeData => generatedThemeData.copyWith(
primaryColor: primaryColor,
cardColor: containerColor,
@ -115,6 +118,7 @@ abstract class ThemeBase {
orderTheme,
sendPageTheme,
seedWidgetTheme,
placeholderTheme,
],
scrollbarTheme: ScrollbarThemeData(
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),