refactor: create AddressTheme for accentTextTheme.displaySmall.color

This commit is contained in:
Rafael Saes 2023-07-03 15:48:27 -03:00
parent a85d8ef5d4
commit 89ab198064
10 changed files with 48 additions and 36 deletions

View file

@ -17,6 +17,7 @@ import 'package:cake_wallet/src/widgets/address_text_field.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
class ContactPage extends BasePage {
ContactPage(this.contactViewModel)
@ -99,10 +100,7 @@ class ContactPage extends BasePage {
AddressTextFieldOption.paste,
AddressTextFieldOption.qrCode,
],
buttonColor: Theme.of(context)
.accentTextTheme!
.displaySmall!
.color!,
buttonColor: Theme.of(context).extension<AddressTheme>()!.actionButtonColor,
iconColor: PaletteDark.gray,
borderColor: Theme.of(context)
.primaryTextTheme!

View file

@ -1,6 +1,7 @@
import 'package:cake_wallet/anonpay/anonpay_invoice_info.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator_icon.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
import 'package:cake_wallet/typography.dart';
import 'package:flutter/material.dart';
@ -38,10 +39,7 @@ class AnonInvoiceStatusSection extends StatelessWidget {
Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: Theme.of(context)
.accentTextTheme!
.displaySmall!
.color!,
color: Theme.of(context).extension<AddressTheme>()!.actionButtonColor,
borderRadius: BorderRadius.circular(10),
),
child: Row(

View file

@ -1,5 +1,6 @@
import 'package:cake_wallet/view_model/settings/choices_list_item.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
class SettingsChoicesCell extends StatelessWidget {
const SettingsChoicesCell(this.choicesListItem, {Key? key}) : super(key: key);
@ -34,10 +35,7 @@ class SettingsChoicesCell extends StatelessWidget {
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Theme.of(context)
.accentTextTheme!
.displaySmall!
.color!,
color: Theme.of(context).extension<AddressTheme>()!.actionButtonColor,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,

View file

@ -5,6 +5,7 @@ import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart';
import 'package:cw_core/currency.dart';
import 'package:cake_wallet/src/widgets/picker_wrapper_widget.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
class Picker<Item> extends StatefulWidget {
Picker({
@ -168,10 +169,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
prefixIcon:
Image.asset("assets/images/search_icon.png"),
filled: true,
fillColor: Theme.of(context)
.accentTextTheme!
.displaySmall!
.color!,
fillColor: Theme.of(context).extension<AddressTheme>()!.actionButtonColor,
alignLabelWithHint: false,
contentPadding: const EdgeInsets.symmetric(
vertical: 4, horizontal: 16),

View file

@ -2,6 +2,7 @@ import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator_icon.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
class StandardListStatusRow extends StatelessWidget {
StandardListStatusRow({required this.title, required this.value});
@ -30,7 +31,7 @@ class StandardListStatusRow extends StatelessWidget {
padding: const EdgeInsets.only(top: 12),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).accentTextTheme!.displaySmall!.color!,
color: Theme.of(context).extension<AddressTheme>()!.actionButtonColor,
borderRadius: BorderRadius.circular(30.0),
),
child: Padding(

View file

@ -209,11 +209,5 @@ class BrightTheme extends LightTheme {
Palette.pinkFlamingo, // second gradient color(menu header)
backgroundColor: Colors.white // active dot color
),
// display2 -> displaySmall
displaySmall: TextStyle(
color:
Palette.shadowWhite, // action button color (address text field)
decorationColor: Palette.darkGray, // hint text (seed widget)
),
));
}

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/address_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/exchange_page_theme.dart';
@ -79,6 +80,10 @@ class DarkTheme extends ThemeBase {
BalancePageTheme get balancePageTheme =>
BalancePageTheme(textColor: PaletteDark.cyanBlue);
@override
AddressTheme get addressTheme =>
AddressTheme(actionButtonColor: PaletteDark.nightBlue);
@override
ThemeData get themeData => super.themeData.copyWith(
indicatorColor: PaletteDark.cyanBlue, // page indicator
@ -243,13 +248,6 @@ class DarkTheme extends ThemeBase {
.deepPurpleBlue, // second gradient color(menu header)
backgroundColor: Colors.white // active dot color
),
// display2 -> displaySmall
displaySmall: TextStyle(
color: PaletteDark
.nightBlue, // action button color (address text field)
decorationColor:
PaletteDark.darkCyanBlue, // hint text (seed widget)
),
),
);
}

View file

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

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/address_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/exchange_page_theme.dart';
@ -80,6 +81,10 @@ class LightTheme extends ThemeBase {
BalancePageTheme get balancePageTheme =>
BalancePageTheme(textColor: Palette.darkBlueCraiola.withOpacity(0.67));
@override
AddressTheme get addressTheme =>
AddressTheme(actionButtonColor: Palette.shadowWhite);
@override
ThemeData get themeData => super.themeData.copyWith(
indicatorColor:
@ -240,12 +245,6 @@ class LightTheme extends ThemeBase {
decorationColor: Palette.blueGreyCraiola, // second gradient color(menu header)
backgroundColor: PaletteDark.darkNightBlue // active dot color
),
// display2 -> displaySmall
displaySmall: TextStyle(
color:
Palette.shadowWhite, // action button color (address text field)
decorationColor: Palette.darkGray, // hint text (seed widget)
),
),
);
}

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/extensions/address_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';
@ -61,6 +62,8 @@ abstract class ThemeBase {
BalancePageTheme get balancePageTheme;
AddressTheme get addressTheme;
ThemeData get themeData => generatedThemeData.copyWith(
primaryColor: primaryColor,
cardColor: containerColor,
@ -75,6 +78,7 @@ abstract class ThemeBase {
exchangePageTheme,
newWalletTheme,
balancePageTheme,
addressTheme,
],
scrollbarTheme: ScrollbarThemeData(
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),