refactor: accentTextTheme.bodySmall.decorationColor -> InfoTheme.textColor

This commit is contained in:
Rafael Saes 2023-07-05 08:35:26 -03:00
parent 7f929ee976
commit b5c90c2f9e
6 changed files with 35 additions and 11 deletions

View file

@ -2,6 +2,7 @@ import 'dart:ui';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
import 'package:cake_wallet/themes/extensions/info_theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/alert_background.dart';
@ -37,7 +38,7 @@ class InformationPage extends StatelessWidget {
fontWeight: FontWeight.normal,
fontFamily: 'Lato',
decoration: TextDecoration.none,
color: Theme.of(context).accentTextTheme!.bodySmall!.decorationColor!
color: Theme.of(context).extension<InfoTheme>()!.textColor
),
),
),

View file

@ -184,9 +184,5 @@ class BrightTheme extends LightTheme {
titleLarge: TextStyle(
backgroundColor: Palette.periwinkleCraiola, // picker divider
),
bodySmall: TextStyle(
decorationColor:
Palette.darkBlueCraiola, // text color (information page)
),
));
}

View file

@ -5,6 +5,7 @@ import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
import 'package:cake_wallet/themes/extensions/indicator_dot_theme.dart';
import 'package:cake_wallet/themes/extensions/info_theme.dart';
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
@ -118,6 +119,9 @@ class DarkTheme extends ThemeBase {
restoreWalletButtonTextColor: Palette.darkBlueCraiola,
createNewWalletButtonBackgroundColor: Colors.white);
@override
InfoTheme get infoTheme => InfoTheme(textColor: Palette.darkLavender);
@override
ThemeData get themeData => super.themeData.copyWith(
indicatorColor: PaletteDark.cyanBlue, // page indicator
@ -233,9 +237,6 @@ class DarkTheme extends ThemeBase {
titleLarge: TextStyle(
backgroundColor: PaletteDark.dividerColor, // picker divider
),
bodySmall: TextStyle(
decorationColor: Palette.darkLavender, // text color (information page)
),
),
);
}

View file

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

View file

@ -5,6 +5,7 @@ import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
import 'package:cake_wallet/themes/extensions/indicator_dot_theme.dart';
import 'package:cake_wallet/themes/extensions/info_theme.dart';
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
@ -119,6 +120,9 @@ class LightTheme extends ThemeBase {
restoreWalletButtonTextColor: Colors.white,
createNewWalletButtonBackgroundColor: Palette.protectiveBlue);
@override
InfoTheme get infoTheme => InfoTheme(textColor: Palette.darkBlueCraiola);
@override
ThemeData get themeData => super.themeData.copyWith(
indicatorColor:
@ -234,9 +238,6 @@ class LightTheme extends ThemeBase {
titleLarge: TextStyle(
backgroundColor: Palette.periwinkleCraiola, // picker divider
),
bodySmall: TextStyle(
decorationColor: Palette.darkBlueCraiola, // text color (information page)
),
),
);
}

View file

@ -4,6 +4,7 @@ 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/exchange_page_theme.dart';
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
import 'package:cake_wallet/themes/extensions/info_theme.dart';
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
@ -73,6 +74,8 @@ abstract class ThemeBase {
WalletListTheme get walletListTheme;
InfoTheme get infoTheme;
ThemeData get themeData => generatedThemeData.copyWith(
primaryColor: primaryColor,
cardColor: containerColor,
@ -91,6 +94,7 @@ abstract class ThemeBase {
menuTheme,
filterTheme,
walletListTheme,
infoTheme,
],
scrollbarTheme: ScrollbarThemeData(
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),