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

View file

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

View file

@ -1,5 +1,6 @@
import 'package:cake_wallet/view_model/settings/choices_list_item.dart'; import 'package:cake_wallet/view_model/settings/choices_list_item.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
class SettingsChoicesCell extends StatelessWidget { class SettingsChoicesCell extends StatelessWidget {
const SettingsChoicesCell(this.choicesListItem, {Key? key}) : super(key: key); const SettingsChoicesCell(this.choicesListItem, {Key? key}) : super(key: key);
@ -34,10 +35,7 @@ class SettingsChoicesCell extends StatelessWidget {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30), borderRadius: BorderRadius.circular(30),
color: Theme.of(context) color: Theme.of(context).extension<AddressTheme>()!.actionButtonColor,
.accentTextTheme!
.displaySmall!
.color!,
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, 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:flutter/material.dart';
import 'package:cw_core/currency.dart'; import 'package:cw_core/currency.dart';
import 'package:cake_wallet/src/widgets/picker_wrapper_widget.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 { class Picker<Item> extends StatefulWidget {
Picker({ Picker({
@ -168,10 +169,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
prefixIcon: prefixIcon:
Image.asset("assets/images/search_icon.png"), Image.asset("assets/images/search_icon.png"),
filled: true, filled: true,
fillColor: Theme.of(context) fillColor: Theme.of(context).extension<AddressTheme>()!.actionButtonColor,
.accentTextTheme!
.displaySmall!
.color!,
alignLabelWithHint: false, alignLabelWithHint: false,
contentPadding: const EdgeInsets.symmetric( contentPadding: const EdgeInsets.symmetric(
vertical: 4, horizontal: 16), 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:cake_wallet/src/screens/dashboard/widgets/sync_indicator_icon.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
class StandardListStatusRow extends StatelessWidget { class StandardListStatusRow extends StatelessWidget {
StandardListStatusRow({required this.title, required this.value}); StandardListStatusRow({required this.title, required this.value});
@ -30,7 +31,7 @@ class StandardListStatusRow extends StatelessWidget {
padding: const EdgeInsets.only(top: 12), padding: const EdgeInsets.only(top: 12),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).accentTextTheme!.displaySmall!.color!, color: Theme.of(context).extension<AddressTheme>()!.actionButtonColor,
borderRadius: BorderRadius.circular(30.0), borderRadius: BorderRadius.circular(30.0),
), ),
child: Padding( child: Padding(

View file

@ -209,11 +209,5 @@ class BrightTheme extends LightTheme {
Palette.pinkFlamingo, // second gradient color(menu header) Palette.pinkFlamingo, // second gradient color(menu header)
backgroundColor: Colors.white // active dot color 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/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/exchange_page_theme.dart'; import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
@ -79,6 +80,10 @@ class DarkTheme extends ThemeBase {
BalancePageTheme get balancePageTheme => BalancePageTheme get balancePageTheme =>
BalancePageTheme(textColor: PaletteDark.cyanBlue); BalancePageTheme(textColor: PaletteDark.cyanBlue);
@override
AddressTheme get addressTheme =>
AddressTheme(actionButtonColor: PaletteDark.nightBlue);
@override @override
ThemeData get themeData => super.themeData.copyWith( ThemeData get themeData => super.themeData.copyWith(
indicatorColor: PaletteDark.cyanBlue, // page indicator indicatorColor: PaletteDark.cyanBlue, // page indicator
@ -243,13 +248,6 @@ class DarkTheme extends ThemeBase {
.deepPurpleBlue, // second gradient color(menu header) .deepPurpleBlue, // second gradient color(menu header)
backgroundColor: Colors.white // active dot color 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/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/exchange_page_theme.dart'; import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
@ -80,6 +81,10 @@ class LightTheme extends ThemeBase {
BalancePageTheme get balancePageTheme => BalancePageTheme get balancePageTheme =>
BalancePageTheme(textColor: Palette.darkBlueCraiola.withOpacity(0.67)); BalancePageTheme(textColor: Palette.darkBlueCraiola.withOpacity(0.67));
@override
AddressTheme get addressTheme =>
AddressTheme(actionButtonColor: Palette.shadowWhite);
@override @override
ThemeData get themeData => super.themeData.copyWith( ThemeData get themeData => super.themeData.copyWith(
indicatorColor: indicatorColor:
@ -240,12 +245,6 @@ class LightTheme extends ThemeBase {
decorationColor: Palette.blueGreyCraiola, // second gradient color(menu header) decorationColor: Palette.blueGreyCraiola, // second gradient color(menu header)
backgroundColor: PaletteDark.darkNightBlue // active dot color 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/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';
@ -61,6 +62,8 @@ abstract class ThemeBase {
BalancePageTheme get balancePageTheme; BalancePageTheme get balancePageTheme;
AddressTheme get addressTheme;
ThemeData get themeData => generatedThemeData.copyWith( ThemeData get themeData => generatedThemeData.copyWith(
primaryColor: primaryColor, primaryColor: primaryColor,
cardColor: containerColor, cardColor: containerColor,
@ -75,6 +78,7 @@ abstract class ThemeBase {
exchangePageTheme, exchangePageTheme,
newWalletTheme, newWalletTheme,
balancePageTheme, balancePageTheme,
addressTheme,
], ],
scrollbarTheme: ScrollbarThemeData( scrollbarTheme: ScrollbarThemeData(
thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor), thumbColor: MaterialStateProperty.all(scrollbarTheme.thumbColor),