token theme colors

This commit is contained in:
julian 2023-04-10 11:28:36 -06:00
parent 5615fbaeca
commit 9b027bd749
14 changed files with 363 additions and 29 deletions

View file

@ -21,6 +21,7 @@ import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
import 'package:tuple/tuple.dart';
@ -44,8 +45,7 @@ class TokenSummary extends ConsumerWidget {
return Stack(
children: [
RoundedContainer(
color: const Color(0xFFE9EAFF), // todo: fix color
// color: Theme.of(context).extension<StackColors>()!.,
color: Theme.of(context).extension<StackColors>()!.tokenSummaryBG,
padding: const EdgeInsets.all(24),
child: Column(
children: [
@ -54,7 +54,9 @@ class TokenSummary extends ConsumerWidget {
children: [
SvgPicture.asset(
Assets.svg.walletDesktop,
color: const Color(0xFF8488AB), // todo: fix color
color: Theme.of(context)
.extension<StackColors>()!
.tokenSummaryTextSecondary,
width: 12,
height: 12,
),
@ -68,7 +70,9 @@ class TokenSummary extends ConsumerWidget {
),
),
style: STextStyles.w500_12(context).copyWith(
color: const Color(0xFF8488AB), // todo: fix color
color: Theme.of(context)
.extension<StackColors>()!
.tokenSummaryTextSecondary,
),
),
],
@ -88,7 +92,11 @@ class TokenSummary extends ConsumerWidget {
),
)}"
" ${token.symbol}",
style: STextStyles.pageTitleH1(context),
style: STextStyles.pageTitleH1(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.tokenSummaryTextPrimary,
),
),
const SizedBox(
width: 10,
@ -119,7 +127,11 @@ class TokenSummary extends ConsumerWidget {
(value) => value.currency,
),
)}",
style: STextStyles.subtitle500(context),
style: STextStyles.subtitle500(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.tokenSummaryTextPrimary,
),
),
const SizedBox(
height: 20,
@ -137,8 +149,13 @@ class TokenSummary extends ConsumerWidget {
child: WalletRefreshButton(
walletId: walletId,
initialSyncStatus: initialSyncStatus,
tokenContractAddress: ref.watch(tokenServiceProvider
.select((value) => value!.tokenContract.address)),
tokenContractAddress: ref.watch(
tokenServiceProvider.select(
(value) => value!.tokenContract.address,
),
),
overrideIconColor:
Theme.of(context).extension<StackColors>()!.topNavIconPrimary,
),
),
],
@ -197,7 +214,7 @@ class TokenWalletOptions extends StatelessWidget {
);
},
subLabel: "Receive",
iconAssetSVG: Assets.svg.receive(context),
iconAssetSVG: Assets.svg.arrowDownLeft,
),
const SizedBox(
width: 16,
@ -214,7 +231,7 @@ class TokenWalletOptions extends StatelessWidget {
);
},
subLabel: "Send",
iconAssetSVG: Assets.svg.send(context),
iconAssetSVG: Assets.svg.arrowUpRight,
),
const SizedBox(
width: 16,
@ -251,12 +268,14 @@ class TokenOptionsButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final iconSize = subLabel == "Send" || subLabel == "Receive" ? 12.0 : 24.0;
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
RawMaterialButton(
fillColor: Theme.of(context).extension<StackColors>()!.popupBG,
fillColor:
Theme.of(context).extension<StackColors>()!.tokenSummaryButtonBG,
elevation: 0,
focusElevation: 0,
hoverElevation: 0,
@ -270,11 +289,27 @@ class TokenOptionsButton extends StatelessWidget {
onPressed: onPressed,
child: Padding(
padding: const EdgeInsets.all(10),
child: SvgPicture.asset(
iconAssetSVG,
color: const Color(0xFF424A97), // todo: fix color
width: 24,
height: 24,
child: ConditionalParent(
condition: iconSize < 24,
builder: (child) => RoundedContainer(
padding: const EdgeInsets.all(6),
color: Theme.of(context)
.extension<StackColors>()!
.tokenSummaryIcon
.withOpacity(0.4),
radiusMultiplier: 10,
child: Center(
child: child,
),
),
child: SvgPicture.asset(
iconAssetSVG,
color: Theme.of(context)
.extension<StackColors>()!
.tokenSummaryIcon,
width: iconSize,
height: iconSize,
),
),
),
),
@ -283,7 +318,11 @@ class TokenOptionsButton extends StatelessWidget {
),
Text(
subLabel,
style: STextStyles.w500_12(context),
style: STextStyles.w500_12(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.tokenSummaryTextPrimary,
),
)
],
);
@ -303,12 +342,14 @@ class CoinTickerTag extends ConsumerWidget {
return RoundedContainer(
padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 4),
radiusMultiplier: 0.25,
color: const Color(0xFF4D5798), // TODO: color theme for multi themes
color: Theme.of(context).extension<StackColors>()!.ethTagBG,
child: Text(
ref.watch(walletsChangeNotifierProvider
.select((value) => value.getManager(walletId).coin.ticker)),
ref.watch(
walletsChangeNotifierProvider
.select((value) => value.getManager(walletId).coin.ticker),
),
style: STextStyles.w600_12(context).copyWith(
color: Colors.white, // TODO: design is wrong?
color: Theme.of(context).extension<StackColors>()!.ethTagText,
),
),
);

View file

@ -110,6 +110,9 @@ class _TokenViewState extends ConsumerState<TokenView> {
child: AppBarIconButton(
icon: SvgPicture.asset(
Assets.svg.verticalEllipsis,
color: Theme.of(context)
.extension<StackColors>()!
.topNavIconPrimary,
),
onPressed: () {
// todo: context menu

View file

@ -22,6 +22,7 @@ class WalletRefreshButton extends ConsumerStatefulWidget {
this.tokenContractAddress,
this.onPressed,
this.eventBus,
this.overrideIconColor,
}) : super(key: key);
final String walletId;
@ -29,6 +30,7 @@ class WalletRefreshButton extends ConsumerStatefulWidget {
final String? tokenContractAddress;
final VoidCallback? onPressed;
final EventBus? eventBus;
final Color? overrideIconColor;
@override
ConsumerState<WalletRefreshButton> createState() => _RefreshButtonState();
@ -155,11 +157,15 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton>
Assets.svg.arrowRotate,
width: isDesktop ? 12 : 24,
height: isDesktop ? 12 : 24,
color: isDesktop
? Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultSearchIconRight
: Theme.of(context).extension<StackColors>()!.textFavoriteCard,
color: widget.overrideIconColor != null
? widget.overrideIconColor!
: isDesktop
? Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultSearchIconRight
: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
),
),
),

View file

@ -335,6 +335,26 @@ class ChanColors extends StackColorTheme {
@override
Color get rateTypeToggleDesktopColorOff => buttonBackSecondary;
// token view colors
@override
Color get ethTagText => const Color(0xFFFFFFFF);
@override
Color get ethTagBG => const Color(0xFF4D5798);
@override
Color get ethWalletTagText => const Color(0xFF4D5798);
@override
Color get ethWalletTagBG => const Color(0xFFF0F3FD);
@override
Color get tokenSummaryTextPrimary => const Color(0xFF232323);
@override
Color get tokenSummaryTextSecondary => const Color(0xFF8488AB);
@override
Color get tokenSummaryBG => const Color(0xFFE9EAFF);
@override
Color get tokenSummaryButtonBG => const Color(0xFFFFFFFF);
@override
Color get tokenSummaryIcon => const Color(0xFF424A97);
@override
BoxShadow get standardBoxShadow => BoxShadow(
color: shadow,

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/theme/chan_colors.dart';
import 'package:stackwallet/utilities/theme/dark_colors.dart';
import 'package:stackwallet/utilities/theme/forest_colors.dart';
import 'package:stackwallet/utilities/theme/fruit_sorbet_colors.dart';
@ -7,9 +8,7 @@ import 'package:stackwallet/utilities/theme/light_colors.dart';
import 'package:stackwallet/utilities/theme/ocean_breeze_colors.dart';
import 'package:stackwallet/utilities/theme/oled_black_colors.dart';
import 'package:stackwallet/utilities/theme/oled_chans_colors.dart';
import 'chan_colors.dart';
import 'orange_colors.dart';
import 'package:stackwallet/utilities/theme/orange_colors.dart';
enum ThemeType {
light,
@ -285,6 +284,17 @@ abstract class StackColorTheme {
Color get rateTypeToggleDesktopColorOn;
Color get rateTypeToggleDesktopColorOff;
// token view colors
Color get ethTagText;
Color get ethTagBG;
Color get ethWalletTagText;
Color get ethWalletTagBG;
Color get tokenSummaryTextPrimary;
Color get tokenSummaryTextSecondary;
Color get tokenSummaryBG;
Color get tokenSummaryButtonBG;
Color get tokenSummaryIcon;
BoxShadow get standardBoxShadow;
BoxShadow? get homeViewButtonBarBoxShadow;
}

View file

@ -335,6 +335,26 @@ class DarkColors extends StackColorTheme {
@override
Color get rateTypeToggleDesktopColorOff => buttonBackSecondary;
// token view colors
@override
Color get ethTagText => const Color(0xFFFFFFFF);
@override
Color get ethTagBG => const Color(0xFF5761A2);
@override
Color get ethWalletTagText => const Color(0xFFE7EBFF);
@override
Color get ethWalletTagBG => const Color(0xFF414868);
@override
Color get tokenSummaryTextPrimary => const Color(0xFFFFFFFF);
@override
Color get tokenSummaryTextSecondary => const Color(0xFFC9D0FF);
@override
Color get tokenSummaryBG => const Color(0xFF464C73);
@override
Color get tokenSummaryButtonBG => const Color(0xFFC9D0FF);
@override
Color get tokenSummaryIcon => const Color(0xFF252C78);
@override
BoxShadow get standardBoxShadow => BoxShadow(
color: shadow,

View file

@ -335,6 +335,26 @@ class ForestColors extends StackColorTheme {
@override
Color get rateTypeToggleDesktopColorOff => buttonBackSecondary;
// token view colors
@override
Color get ethTagText => const Color(0xFFFFFFFF);
@override
Color get ethTagBG => const Color(0xFF4D5798);
@override
Color get ethWalletTagText => const Color(0xFF4D5798);
@override
Color get ethWalletTagBG => const Color(0xFFEBEFFE);
@override
Color get tokenSummaryTextPrimary => const Color(0xFF232323);
@override
Color get tokenSummaryTextSecondary => const Color(0xFF4D5798);
@override
Color get tokenSummaryBG => const Color(0xFFFFFFFF);
@override
Color get tokenSummaryButtonBG => const Color(0xFFE9FBEF);
@override
Color get tokenSummaryIcon => const Color(0xFF22867A);
@override
BoxShadow get standardBoxShadow => BoxShadow(
color: shadow,

View file

@ -335,6 +335,26 @@ class FruitSorbetColors extends StackColorTheme {
@override
Color get rateTypeToggleDesktopColorOff => popupBG;
// token view colors
@override
Color get ethTagText => const Color(0xFFFFFFFF);
@override
Color get ethTagBG => const Color(0xFF4D5798);
@override
Color get ethWalletTagText => const Color(0xFF4D5798);
@override
Color get ethWalletTagBG => const Color(0xFFEBEFFE);
@override
Color get tokenSummaryTextPrimary => const Color(0xFF232323);
@override
Color get tokenSummaryTextSecondary => const Color(0xFF4D5798);
@override
Color get tokenSummaryBG => const Color(0xFFFFF8EE);
@override
Color get tokenSummaryButtonBG => const Color(0xFFFEDED4);
@override
Color get tokenSummaryIcon => const Color(0xFFF62A45);
@override
BoxShadow get standardBoxShadow => BoxShadow(
color: shadow,

View file

@ -335,6 +335,26 @@ class LightColors extends StackColorTheme {
@override
Color get rateTypeToggleDesktopColorOff => buttonBackSecondary;
// token view colors
@override
Color get ethTagText => const Color(0xFFFFFFFF);
@override
Color get ethTagBG => const Color(0xFF4D5798);
@override
Color get ethWalletTagText => const Color(0xFF4D5798);
@override
Color get ethWalletTagBG => const Color(0xFFF0F3FD);
@override
Color get tokenSummaryTextPrimary => const Color(0xFF232323);
@override
Color get tokenSummaryTextSecondary => const Color(0xFF8488AB);
@override
Color get tokenSummaryBG => const Color(0xFFE9EAFF);
@override
Color get tokenSummaryButtonBG => const Color(0xFFFFFFFF);
@override
Color get tokenSummaryIcon => const Color(0xFF424A97);
@override
BoxShadow get standardBoxShadow => BoxShadow(
color: shadow,

View file

@ -342,6 +342,26 @@ class OceanBreezeColors extends StackColorTheme {
@override
Color get rateTypeToggleDesktopColorOff => buttonBackSecondary;
// token view colors
@override
Color get ethTagText => const Color(0xFFFFFFFF);
@override
Color get ethTagBG => const Color(0xFF4D5798);
@override
Color get ethWalletTagText => const Color(0xFF4D5798);
@override
Color get ethWalletTagBG => const Color(0xFFEBEFFE);
@override
Color get tokenSummaryTextPrimary => const Color(0xFF232323);
@override
Color get tokenSummaryTextSecondary => const Color(0xFF4D5798);
@override
Color get tokenSummaryBG => const Color(0xFFFFFFFF);
@override
Color get tokenSummaryButtonBG => const Color(0xFFEDF4F9);
@override
Color get tokenSummaryIcon => const Color(0xFF197287);
@override
BoxShadow get standardBoxShadow => BoxShadow(
color: shadow,

View file

@ -338,6 +338,26 @@ class OledBlackColors extends StackColorTheme {
@override
Color get rateTypeToggleDesktopColorOff => buttonBackSecondary;
// token view colors
@override
Color get ethTagText => const Color(0xFFFFFFFF);
@override
Color get ethTagBG => const Color(0xFF5761A2);
@override
Color get ethWalletTagText => const Color(0xFFDEDEDE);
@override
Color get ethWalletTagBG => const Color(0xFF222539);
@override
Color get tokenSummaryTextPrimary => const Color(0xFFFFFFFF);
@override
Color get tokenSummaryTextSecondary => const Color(0xFFC9D0FF);
@override
Color get tokenSummaryBG => const Color(0xFF292D45);
@override
Color get tokenSummaryButtonBG => const Color(0xFFC9D0FF);
@override
Color get tokenSummaryIcon => const Color(0xFF252C78);
@override
BoxShadow get standardBoxShadow => BoxShadow(
color: shadow,

View file

@ -335,6 +335,26 @@ class DarkChansColors extends StackColorTheme {
@override
Color get rateTypeToggleDesktopColorOff => buttonBackSecondary;
// token view colors
@override
Color get ethTagText => const Color(0xFFFFFFFF);
@override
Color get ethTagBG => const Color(0xFF5761A2);
@override
Color get ethWalletTagText => const Color(0xFFDEDEDE);
@override
Color get ethWalletTagBG => const Color(0xFF222539);
@override
Color get tokenSummaryTextPrimary => const Color(0xFFFFFFFF);
@override
Color get tokenSummaryTextSecondary => const Color(0xFFC9D0FF);
@override
Color get tokenSummaryBG => const Color(0xFF292D45);
@override
Color get tokenSummaryButtonBG => const Color(0xFFC9D0FF);
@override
Color get tokenSummaryIcon => const Color(0xFF252C78);
@override
BoxShadow get standardBoxShadow => BoxShadow(
color: shadow,

View file

@ -335,6 +335,26 @@ class OrangeColors extends StackColorTheme {
@override
Color get rateTypeToggleDesktopColorOff => buttonBackSecondary;
// token view colors
@override
Color get ethTagText => const Color(0xFFFFFFFF);
@override
Color get ethTagBG => const Color(0xFF4D5798);
@override
Color get ethWalletTagText => const Color(0xFF4D5798);
@override
Color get ethWalletTagBG => const Color(0xFFEBEFFE);
@override
Color get tokenSummaryTextPrimary => const Color(0xFF232323);
@override
Color get tokenSummaryTextSecondary => const Color(0xFF4D5798);
@override
Color get tokenSummaryBG => const Color(0xFFFFFFFF);
@override
Color get tokenSummaryButtonBG => const Color(0xAAFFC58F);
@override
Color get tokenSummaryIcon => const Color(0xFFF36B43);
@override
BoxShadow get standardBoxShadow => BoxShadow(
color: shadow,

View file

@ -187,6 +187,17 @@ class StackColors extends ThemeExtension<StackColors> {
final Color rateTypeToggleDesktopColorOn;
final Color rateTypeToggleDesktopColorOff;
// token view colors
final Color ethTagText;
final Color ethTagBG;
final Color ethWalletTagText;
final Color ethWalletTagBG;
final Color tokenSummaryTextPrimary;
final Color tokenSummaryTextSecondary;
final Color tokenSummaryBG;
final Color tokenSummaryButtonBG;
final Color tokenSummaryIcon;
final BoxShadow standardBoxShadow;
final BoxShadow? homeViewButtonBarBoxShadow;
@ -337,6 +348,15 @@ class StackColors extends ThemeExtension<StackColors> {
required this.rateTypeToggleDesktopColorOff,
required this.standardBoxShadow,
required this.homeViewButtonBarBoxShadow,
required this.ethTagText,
required this.ethTagBG,
required this.ethWalletTagText,
required this.ethWalletTagBG,
required this.tokenSummaryTextPrimary,
required this.tokenSummaryTextSecondary,
required this.tokenSummaryBG,
required this.tokenSummaryButtonBG,
required this.tokenSummaryIcon,
});
factory StackColors.fromStackColorTheme(StackColorTheme colorTheme) {
@ -490,6 +510,15 @@ class StackColors extends ThemeExtension<StackColors> {
rateTypeToggleDesktopColorOff: colorTheme.rateTypeToggleDesktopColorOff,
homeViewButtonBarBoxShadow: colorTheme.homeViewButtonBarBoxShadow,
standardBoxShadow: colorTheme.standardBoxShadow,
ethTagText: colorTheme.ethTagText,
ethTagBG: colorTheme.ethTagBG,
ethWalletTagText: colorTheme.ethWalletTagText,
ethWalletTagBG: colorTheme.ethWalletTagBG,
tokenSummaryTextPrimary: colorTheme.tokenSummaryTextPrimary,
tokenSummaryTextSecondary: colorTheme.tokenSummaryTextSecondary,
tokenSummaryBG: colorTheme.tokenSummaryBG,
tokenSummaryButtonBG: colorTheme.tokenSummaryButtonBG,
tokenSummaryIcon: colorTheme.tokenSummaryIcon,
);
}
@ -639,6 +668,15 @@ class StackColors extends ThemeExtension<StackColors> {
Color? rateTypeToggleColorOff,
Color? rateTypeToggleDesktopColorOn,
Color? rateTypeToggleDesktopColorOff,
Color? ethTagText,
Color? ethTagBG,
Color? ethWalletTagText,
Color? ethWalletTagBG,
Color? tokenSummaryTextPrimary,
Color? tokenSummaryTextSecondary,
Color? tokenSummaryBG,
Color? tokenSummaryButtonBG,
Color? tokenSummaryIcon,
BoxShadow? homeViewButtonBarBoxShadow,
BoxShadow? standardBoxShadow,
}) {
@ -833,6 +871,17 @@ class StackColors extends ThemeExtension<StackColors> {
rateTypeToggleDesktopColorOn ?? this.rateTypeToggleDesktopColorOn,
rateTypeToggleDesktopColorOff:
rateTypeToggleDesktopColorOff ?? this.rateTypeToggleDesktopColorOff,
ethTagText: ethTagText ?? this.ethTagText,
ethTagBG: ethTagBG ?? this.ethTagBG,
ethWalletTagText: ethWalletTagText ?? this.ethWalletTagText,
ethWalletTagBG: ethWalletTagBG ?? this.ethWalletTagBG,
tokenSummaryTextPrimary:
tokenSummaryTextPrimary ?? this.tokenSummaryTextPrimary,
tokenSummaryTextSecondary:
tokenSummaryTextSecondary ?? this.tokenSummaryTextSecondary,
tokenSummaryBG: tokenSummaryBG ?? this.tokenSummaryBG,
tokenSummaryButtonBG: tokenSummaryButtonBG ?? this.tokenSummaryButtonBG,
tokenSummaryIcon: tokenSummaryIcon ?? this.tokenSummaryIcon,
homeViewButtonBarBoxShadow:
homeViewButtonBarBoxShadow ?? this.homeViewButtonBarBoxShadow,
standardBoxShadow: standardBoxShadow ?? this.standardBoxShadow,
@ -1557,6 +1606,51 @@ class StackColors extends ThemeExtension<StackColors> {
other.rateTypeToggleDesktopColorOff,
t,
)!,
ethTagText: Color.lerp(
ethTagText,
other.ethTagText,
t,
)!,
ethTagBG: Color.lerp(
ethTagBG,
other.ethTagBG,
t,
)!,
ethWalletTagText: Color.lerp(
ethWalletTagText,
other.ethWalletTagText,
t,
)!,
ethWalletTagBG: Color.lerp(
ethWalletTagBG,
other.ethWalletTagBG,
t,
)!,
tokenSummaryTextPrimary: Color.lerp(
tokenSummaryTextPrimary,
other.tokenSummaryTextPrimary,
t,
)!,
tokenSummaryTextSecondary: Color.lerp(
tokenSummaryTextSecondary,
other.tokenSummaryTextSecondary,
t,
)!,
tokenSummaryBG: Color.lerp(
tokenSummaryBG,
other.tokenSummaryBG,
t,
)!,
tokenSummaryButtonBG: Color.lerp(
tokenSummaryButtonBG,
other.tokenSummaryButtonBG,
t,
)!,
tokenSummaryIcon: Color.lerp(
tokenSummaryIcon,
other.tokenSummaryIcon,
t,
)!,
);
}