Merge remote-tracking branch 'origin/staging' into appConfig

This commit is contained in:
julian 2024-05-14 11:30:40 -06:00
commit bb1dc22af1
14 changed files with 842 additions and 579 deletions

View file

@ -13,11 +13,11 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:stackwallet/themes/color_theme.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/extensions/impl/box_shadow.dart'; import 'package:stackwallet/utilities/extensions/impl/box_shadow.dart';
import 'package:stackwallet/utilities/extensions/impl/gradient.dart'; import 'package:stackwallet/utilities/extensions/impl/gradient.dart';
import 'package:stackwallet/utilities/extensions/impl/string.dart'; import 'package:stackwallet/utilities/extensions/impl/string.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/stack_file_system.dart'; import 'package:stackwallet/utilities/stack_file_system.dart';
part 'stack_theme.g.dart'; part 'stack_theme.g.dart';
@ -45,7 +45,7 @@ class StackTheme {
case "dark": case "dark":
return Brightness.dark; return Brightness.dark;
default: default:
// just return light instead of a possible crash causing error // just return light instead of a possible crash causing error
return Brightness.light; return Brightness.light;
} }
} }
@ -131,8 +131,8 @@ class StackTheme {
@ignore @ignore
Color get accentColorBlue => _accentColorBlue ??= Color( Color get accentColorBlue => _accentColorBlue ??= Color(
accentColorBlueInt, accentColorBlueInt,
); );
@ignore @ignore
Color? _accentColorBlue; Color? _accentColorBlue;
late final int accentColorBlueInt; late final int accentColorBlueInt;
@ -141,8 +141,8 @@ class StackTheme {
@ignore @ignore
Color get accentColorGreen => _accentColorGreen ??= Color( Color get accentColorGreen => _accentColorGreen ??= Color(
accentColorGreenInt, accentColorGreenInt,
); );
@ignore @ignore
Color? _accentColorGreen; Color? _accentColorGreen;
late final int accentColorGreenInt; late final int accentColorGreenInt;
@ -151,8 +151,8 @@ class StackTheme {
@ignore @ignore
Color get accentColorYellow => _accentColorYellow ??= Color( Color get accentColorYellow => _accentColorYellow ??= Color(
accentColorYellowInt, accentColorYellowInt,
); );
@ignore @ignore
Color? _accentColorYellow; Color? _accentColorYellow;
late final int accentColorYellowInt; late final int accentColorYellowInt;
@ -161,8 +161,8 @@ class StackTheme {
@ignore @ignore
Color get accentColorRed => _accentColorRed ??= Color( Color get accentColorRed => _accentColorRed ??= Color(
accentColorRedInt, accentColorRedInt,
); );
@ignore @ignore
Color? _accentColorRed; Color? _accentColorRed;
late final int accentColorRedInt; late final int accentColorRedInt;
@ -171,8 +171,8 @@ class StackTheme {
@ignore @ignore
Color get accentColorOrange => _accentColorOrange ??= Color( Color get accentColorOrange => _accentColorOrange ??= Color(
accentColorOrangeInt, accentColorOrangeInt,
); );
@ignore @ignore
Color? _accentColorOrange; Color? _accentColorOrange;
late final int accentColorOrangeInt; late final int accentColorOrangeInt;
@ -181,8 +181,8 @@ class StackTheme {
@ignore @ignore
Color get accentColorDark => _accentColorDark ??= Color( Color get accentColorDark => _accentColorDark ??= Color(
accentColorDarkInt, accentColorDarkInt,
); );
@ignore @ignore
Color? _accentColorDark; Color? _accentColorDark;
late final int accentColorDarkInt; late final int accentColorDarkInt;
@ -191,8 +191,8 @@ class StackTheme {
@ignore @ignore
Color get shadow => _shadow ??= Color( Color get shadow => _shadow ??= Color(
shadowInt, shadowInt,
); );
@ignore @ignore
Color? _shadow; Color? _shadow;
late final int shadowInt; late final int shadowInt;
@ -201,8 +201,8 @@ class StackTheme {
@ignore @ignore
Color get textDark => _textDark ??= Color( Color get textDark => _textDark ??= Color(
textDarkInt, textDarkInt,
); );
@ignore @ignore
Color? _textDark; Color? _textDark;
late final int textDarkInt; late final int textDarkInt;
@ -211,8 +211,8 @@ class StackTheme {
@ignore @ignore
Color get textDark2 => _textDark2 ??= Color( Color get textDark2 => _textDark2 ??= Color(
textDark2Int, textDark2Int,
); );
@ignore @ignore
Color? _textDark2; Color? _textDark2;
late final int textDark2Int; late final int textDark2Int;
@ -221,8 +221,8 @@ class StackTheme {
@ignore @ignore
Color get textDark3 => _textDark3 ??= Color( Color get textDark3 => _textDark3 ??= Color(
textDark3Int, textDark3Int,
); );
@ignore @ignore
Color? _textDark3; Color? _textDark3;
late final int textDark3Int; late final int textDark3Int;
@ -231,8 +231,8 @@ class StackTheme {
@ignore @ignore
Color get textSubtitle1 => _textSubtitle1 ??= Color( Color get textSubtitle1 => _textSubtitle1 ??= Color(
textSubtitle1Int, textSubtitle1Int,
); );
@ignore @ignore
Color? _textSubtitle1; Color? _textSubtitle1;
late final int textSubtitle1Int; late final int textSubtitle1Int;
@ -241,8 +241,8 @@ class StackTheme {
@ignore @ignore
Color get textSubtitle2 => _textSubtitle2 ??= Color( Color get textSubtitle2 => _textSubtitle2 ??= Color(
textSubtitle2Int, textSubtitle2Int,
); );
@ignore @ignore
Color? _textSubtitle2; Color? _textSubtitle2;
late final int textSubtitle2Int; late final int textSubtitle2Int;
@ -251,8 +251,8 @@ class StackTheme {
@ignore @ignore
Color get textSubtitle3 => _textSubtitle3 ??= Color( Color get textSubtitle3 => _textSubtitle3 ??= Color(
textSubtitle3Int, textSubtitle3Int,
); );
@ignore @ignore
Color? _textSubtitle3; Color? _textSubtitle3;
late final int textSubtitle3Int; late final int textSubtitle3Int;
@ -261,8 +261,8 @@ class StackTheme {
@ignore @ignore
Color get textSubtitle4 => _textSubtitle4 ??= Color( Color get textSubtitle4 => _textSubtitle4 ??= Color(
textSubtitle4Int, textSubtitle4Int,
); );
@ignore @ignore
Color? _textSubtitle4; Color? _textSubtitle4;
late final int textSubtitle4Int; late final int textSubtitle4Int;
@ -271,8 +271,8 @@ class StackTheme {
@ignore @ignore
Color get textSubtitle5 => _textSubtitle5 ??= Color( Color get textSubtitle5 => _textSubtitle5 ??= Color(
textSubtitle5Int, textSubtitle5Int,
); );
@ignore @ignore
Color? _textSubtitle5; Color? _textSubtitle5;
late final int textSubtitle5Int; late final int textSubtitle5Int;
@ -281,8 +281,8 @@ class StackTheme {
@ignore @ignore
Color get textSubtitle6 => _textSubtitle6 ??= Color( Color get textSubtitle6 => _textSubtitle6 ??= Color(
textSubtitle6Int, textSubtitle6Int,
); );
@ignore @ignore
Color? _textSubtitle6; Color? _textSubtitle6;
late final int textSubtitle6Int; late final int textSubtitle6Int;
@ -291,8 +291,8 @@ class StackTheme {
@ignore @ignore
Color get textWhite => _textWhite ??= Color( Color get textWhite => _textWhite ??= Color(
textWhiteInt, textWhiteInt,
); );
@ignore @ignore
Color? _textWhite; Color? _textWhite;
late final int textWhiteInt; late final int textWhiteInt;
@ -301,8 +301,8 @@ class StackTheme {
@ignore @ignore
Color get textFavoriteCard => _textFavoriteCard ??= Color( Color get textFavoriteCard => _textFavoriteCard ??= Color(
textFavoriteCardInt, textFavoriteCardInt,
); );
@ignore @ignore
Color? _textFavoriteCard; Color? _textFavoriteCard;
late final int textFavoriteCardInt; late final int textFavoriteCardInt;
@ -311,8 +311,8 @@ class StackTheme {
@ignore @ignore
Color get textError => _textError ??= Color( Color get textError => _textError ??= Color(
textErrorInt, textErrorInt,
); );
@ignore @ignore
Color? _textError; Color? _textError;
late final int textErrorInt; late final int textErrorInt;
@ -321,8 +321,8 @@ class StackTheme {
@ignore @ignore
Color get textRestore => _textRestore ??= Color( Color get textRestore => _textRestore ??= Color(
textRestoreInt, textRestoreInt,
); );
@ignore @ignore
Color? _textRestore; Color? _textRestore;
late final int textRestoreInt; late final int textRestoreInt;
@ -331,8 +331,8 @@ class StackTheme {
@ignore @ignore
Color get buttonBackPrimary => _buttonBackPrimary ??= Color( Color get buttonBackPrimary => _buttonBackPrimary ??= Color(
buttonBackPrimaryInt, buttonBackPrimaryInt,
); );
@ignore @ignore
Color? _buttonBackPrimary; Color? _buttonBackPrimary;
late final int buttonBackPrimaryInt; late final int buttonBackPrimaryInt;
@ -341,8 +341,8 @@ class StackTheme {
@ignore @ignore
Color get buttonBackSecondary => _buttonBackSecondary ??= Color( Color get buttonBackSecondary => _buttonBackSecondary ??= Color(
buttonBackSecondaryInt, buttonBackSecondaryInt,
); );
@ignore @ignore
Color? _buttonBackSecondary; Color? _buttonBackSecondary;
late final int buttonBackSecondaryInt; late final int buttonBackSecondaryInt;
@ -351,8 +351,8 @@ class StackTheme {
@ignore @ignore
Color get buttonBackPrimaryDisabled => _buttonBackPrimaryDisabled ??= Color( Color get buttonBackPrimaryDisabled => _buttonBackPrimaryDisabled ??= Color(
buttonBackPrimaryDisabledInt, buttonBackPrimaryDisabledInt,
); );
@ignore @ignore
Color? _buttonBackPrimaryDisabled; Color? _buttonBackPrimaryDisabled;
late final int buttonBackPrimaryDisabledInt; late final int buttonBackPrimaryDisabledInt;
@ -372,8 +372,8 @@ class StackTheme {
@ignore @ignore
Color get buttonBackBorder => _buttonBackBorder ??= Color( Color get buttonBackBorder => _buttonBackBorder ??= Color(
buttonBackBorderInt, buttonBackBorderInt,
); );
@ignore @ignore
Color? _buttonBackBorder; Color? _buttonBackBorder;
late final int buttonBackBorderInt; late final int buttonBackBorderInt;
@ -382,8 +382,8 @@ class StackTheme {
@ignore @ignore
Color get buttonBackBorderDisabled => _buttonBackBorderDisabled ??= Color( Color get buttonBackBorderDisabled => _buttonBackBorderDisabled ??= Color(
buttonBackBorderDisabledInt, buttonBackBorderDisabledInt,
); );
@ignore @ignore
Color? _buttonBackBorderDisabled; Color? _buttonBackBorderDisabled;
late final int buttonBackBorderDisabledInt; late final int buttonBackBorderDisabledInt;
@ -392,8 +392,8 @@ class StackTheme {
@ignore @ignore
Color get buttonBackBorderSecondary => _buttonBackBorderSecondary ??= Color( Color get buttonBackBorderSecondary => _buttonBackBorderSecondary ??= Color(
buttonBackBorderSecondaryInt, buttonBackBorderSecondaryInt,
); );
@ignore @ignore
Color? _buttonBackBorderSecondary; Color? _buttonBackBorderSecondary;
late final int buttonBackBorderSecondaryInt; late final int buttonBackBorderSecondaryInt;
@ -413,8 +413,8 @@ class StackTheme {
@ignore @ignore
Color get numberBackDefault => _numberBackDefault ??= Color( Color get numberBackDefault => _numberBackDefault ??= Color(
numberBackDefaultInt, numberBackDefaultInt,
); );
@ignore @ignore
Color? _numberBackDefault; Color? _numberBackDefault;
late final int numberBackDefaultInt; late final int numberBackDefaultInt;
@ -423,8 +423,8 @@ class StackTheme {
@ignore @ignore
Color get numpadBackDefault => _numpadBackDefault ??= Color( Color get numpadBackDefault => _numpadBackDefault ??= Color(
numpadBackDefaultInt, numpadBackDefaultInt,
); );
@ignore @ignore
Color? _numpadBackDefault; Color? _numpadBackDefault;
late final int numpadBackDefaultInt; late final int numpadBackDefaultInt;
@ -433,8 +433,8 @@ class StackTheme {
@ignore @ignore
Color get bottomNavBack => _bottomNavBack ??= Color( Color get bottomNavBack => _bottomNavBack ??= Color(
bottomNavBackInt, bottomNavBackInt,
); );
@ignore @ignore
Color? _bottomNavBack; Color? _bottomNavBack;
late final int bottomNavBackInt; late final int bottomNavBackInt;
@ -443,8 +443,8 @@ class StackTheme {
@ignore @ignore
Color get buttonTextPrimary => _buttonTextPrimary ??= Color( Color get buttonTextPrimary => _buttonTextPrimary ??= Color(
buttonTextPrimaryInt, buttonTextPrimaryInt,
); );
@ignore @ignore
Color? _buttonTextPrimary; Color? _buttonTextPrimary;
late final int buttonTextPrimaryInt; late final int buttonTextPrimaryInt;
@ -453,8 +453,8 @@ class StackTheme {
@ignore @ignore
Color get buttonTextSecondary => _buttonTextSecondary ??= Color( Color get buttonTextSecondary => _buttonTextSecondary ??= Color(
buttonTextSecondaryInt, buttonTextSecondaryInt,
); );
@ignore @ignore
Color? _buttonTextSecondary; Color? _buttonTextSecondary;
late final int buttonTextSecondaryInt; late final int buttonTextSecondaryInt;
@ -463,8 +463,8 @@ class StackTheme {
@ignore @ignore
Color get buttonTextPrimaryDisabled => _buttonTextPrimaryDisabled ??= Color( Color get buttonTextPrimaryDisabled => _buttonTextPrimaryDisabled ??= Color(
buttonTextPrimaryDisabledInt, buttonTextPrimaryDisabledInt,
); );
@ignore @ignore
Color? _buttonTextPrimaryDisabled; Color? _buttonTextPrimaryDisabled;
late final int buttonTextPrimaryDisabledInt; late final int buttonTextPrimaryDisabledInt;
@ -1517,117 +1517,117 @@ class StackTheme {
..version = version ..version = version
..assetsV1 = version == 1 ..assetsV1 = version == 1
? ThemeAssets.fromJson( ? ThemeAssets.fromJson(
json: Map<String, dynamic>.from(json["assets"] as Map), json: Map<String, dynamic>.from(json["assets"] as Map),
themeId: json["id"] as String, themeId: json["id"] as String,
) )
: null : null
..assetsV2 = version == 2 ..assetsV2 = version == 2
? ThemeAssetsV2.fromJson( ? ThemeAssetsV2.fromJson(
json: Map<String, dynamic>.from(json["assets"] as Map), json: Map<String, dynamic>.from(json["assets"] as Map),
themeId: json["id"] as String, themeId: json["id"] as String,
) )
: null : null
..assetsV3 = version >= 3 ..assetsV3 = version >= 3
? ThemeAssetsV3.fromJson( ? ThemeAssetsV3.fromJson(
json: Map<String, dynamic>.from(json["assets"] as Map), json: Map<String, dynamic>.from(json["assets"] as Map),
themeId: json["id"] as String, themeId: json["id"] as String,
) )
: null : null
..themeId = json["id"] as String ..themeId = json["id"] as String
..name = json["name"] as String ..name = json["name"] as String
..brightnessString = json["brightness"] as String ..brightnessString = json["brightness"] as String
..backgroundInt = parseColor(json["colors"]["background"] as String) ..backgroundInt = parseColor(json["colors"]["background"] as String)
..backgroundAppBarInt = ..backgroundAppBarInt =
parseColor(json["colors"]["background_app_bar"] as String) parseColor(json["colors"]["background_app_bar"] as String)
..gradientBackgroundString = json["colors"]["gradients"] != null ..gradientBackgroundString = json["colors"]["gradients"] != null
? jsonEncode(json["colors"]["gradients"]) ? jsonEncode(json["colors"]["gradients"])
: null : null
..standardBoxShadowString = ..standardBoxShadowString =
jsonEncode(json["colors"]["box_shadows"]["standard"] as Map) jsonEncode(json["colors"]["box_shadows"]["standard"] as Map)
..homeViewButtonBarBoxShadowString = ..homeViewButtonBarBoxShadowString =
json["colors"]["box_shadows"]["home_view_button_bar"] == null json["colors"]["box_shadows"]["home_view_button_bar"] == null
? null ? null
: jsonEncode( : jsonEncode(
json["colors"]["box_shadows"]["home_view_button_bar"] as Map) json["colors"]["box_shadows"]["home_view_button_bar"] as Map)
..coinColorsJsonString = jsonEncode(json["colors"]['coin'] as Map) ..coinColorsJsonString = jsonEncode(json["colors"]['coin'] as Map)
..overlayInt = parseColor(json["colors"]["overlay"] as String) ..overlayInt = parseColor(json["colors"]["overlay"] as String)
..accentColorBlueInt = ..accentColorBlueInt =
parseColor(json["colors"]["accent_color_blue"] as String) parseColor(json["colors"]["accent_color_blue"] as String)
..accentColorGreenInt = ..accentColorGreenInt =
parseColor(json["colors"]["accent_color_green"] as String) parseColor(json["colors"]["accent_color_green"] as String)
..accentColorYellowInt = ..accentColorYellowInt =
parseColor(json["colors"]["accent_color_yellow"] as String) parseColor(json["colors"]["accent_color_yellow"] as String)
..accentColorRedInt = ..accentColorRedInt =
parseColor(json["colors"]["accent_color_red"] as String) parseColor(json["colors"]["accent_color_red"] as String)
..accentColorOrangeInt = ..accentColorOrangeInt =
parseColor(json["colors"]["accent_color_orange"] as String) parseColor(json["colors"]["accent_color_orange"] as String)
..accentColorDarkInt = ..accentColorDarkInt =
parseColor(json["colors"]["accent_color_dark"] as String) parseColor(json["colors"]["accent_color_dark"] as String)
..shadowInt = parseColor(json["colors"]["shadow"] as String) ..shadowInt = parseColor(json["colors"]["shadow"] as String)
..textDarkInt = parseColor(json["colors"]["text_dark_one"] as String) ..textDarkInt = parseColor(json["colors"]["text_dark_one"] as String)
..textDark2Int = parseColor(json["colors"]["text_dark_two"] as String) ..textDark2Int = parseColor(json["colors"]["text_dark_two"] as String)
..textDark3Int = parseColor(json["colors"]["text_dark_three"] as String) ..textDark3Int = parseColor(json["colors"]["text_dark_three"] as String)
..textWhiteInt = parseColor(json["colors"]["text_white"] as String) ..textWhiteInt = parseColor(json["colors"]["text_white"] as String)
..textFavoriteCardInt = ..textFavoriteCardInt =
parseColor(json["colors"]["text_favorite"] as String) parseColor(json["colors"]["text_favorite"] as String)
..textErrorInt = parseColor(json["colors"]["text_error"] as String) ..textErrorInt = parseColor(json["colors"]["text_error"] as String)
..textRestoreInt = parseColor(json["colors"]["text_restore"] as String) ..textRestoreInt = parseColor(json["colors"]["text_restore"] as String)
..buttonBackPrimaryInt = ..buttonBackPrimaryInt =
parseColor(json["colors"]["button_back_primary"] as String) parseColor(json["colors"]["button_back_primary"] as String)
..buttonBackSecondaryInt = ..buttonBackSecondaryInt =
parseColor(json["colors"]["button_back_secondary"] as String) parseColor(json["colors"]["button_back_secondary"] as String)
..buttonBackPrimaryDisabledInt = ..buttonBackPrimaryDisabledInt =
parseColor(json["colors"]["button_back_primary_disabled"] as String) parseColor(json["colors"]["button_back_primary_disabled"] as String)
..buttonBackSecondaryDisabledInt = ..buttonBackSecondaryDisabledInt =
parseColor(json["colors"]["button_back_secondary_disabled"] as String) parseColor(json["colors"]["button_back_secondary_disabled"] as String)
..buttonBackBorderInt = ..buttonBackBorderInt =
parseColor(json["colors"]["button_back_border"] as String) parseColor(json["colors"]["button_back_border"] as String)
..buttonBackBorderDisabledInt = ..buttonBackBorderDisabledInt =
parseColor(json["colors"]["button_back_border_disabled"] as String) parseColor(json["colors"]["button_back_border_disabled"] as String)
..buttonBackBorderSecondaryInt = ..buttonBackBorderSecondaryInt =
parseColor(json["colors"]["button_back_border_secondary"] as String) parseColor(json["colors"]["button_back_border_secondary"] as String)
..buttonBackBorderSecondaryDisabledInt = parseColor( ..buttonBackBorderSecondaryDisabledInt = parseColor(
json["colors"]["button_back_border_secondary_disabled"] as String) json["colors"]["button_back_border_secondary_disabled"] as String)
..numberBackDefaultInt = ..numberBackDefaultInt =
parseColor(json["colors"]["number_back_default"] as String) parseColor(json["colors"]["number_back_default"] as String)
..numpadBackDefaultInt = ..numpadBackDefaultInt =
parseColor(json["colors"]["numpad_back_default"] as String) parseColor(json["colors"]["numpad_back_default"] as String)
..bottomNavBackInt = ..bottomNavBackInt =
parseColor(json["colors"]["bottom_nav_back"] as String) parseColor(json["colors"]["bottom_nav_back"] as String)
..textSubtitle1Int = ..textSubtitle1Int =
parseColor(json["colors"]["text_subtitle_one"] as String) parseColor(json["colors"]["text_subtitle_one"] as String)
..textSubtitle2Int = ..textSubtitle2Int =
parseColor(json["colors"]["text_subtitle_two"] as String) parseColor(json["colors"]["text_subtitle_two"] as String)
..textSubtitle3Int = ..textSubtitle3Int =
parseColor(json["colors"]["text_subtitle_three"] as String) parseColor(json["colors"]["text_subtitle_three"] as String)
..textSubtitle4Int = ..textSubtitle4Int =
parseColor(json["colors"]["text_subtitle_four"] as String) parseColor(json["colors"]["text_subtitle_four"] as String)
..textSubtitle5Int = ..textSubtitle5Int =
parseColor(json["colors"]["text_subtitle_five"] as String) parseColor(json["colors"]["text_subtitle_five"] as String)
..textSubtitle6Int = ..textSubtitle6Int =
parseColor(json["colors"]["text_subtitle_six"] as String) parseColor(json["colors"]["text_subtitle_six"] as String)
..buttonTextPrimaryInt = ..buttonTextPrimaryInt =
parseColor(json["colors"]["button_text_primary"] as String) parseColor(json["colors"]["button_text_primary"] as String)
..buttonTextSecondaryInt = ..buttonTextSecondaryInt =
parseColor(json["colors"]["button_text_secondary"] as String) parseColor(json["colors"]["button_text_secondary"] as String)
..buttonTextPrimaryDisabledInt = ..buttonTextPrimaryDisabledInt =
parseColor(json["colors"]["button_text_primary_disabled"] as String) parseColor(json["colors"]["button_text_primary_disabled"] as String)
..buttonTextSecondaryDisabledInt = ..buttonTextSecondaryDisabledInt =
parseColor(json["colors"]["button_text_secondary_disabled"] as String) parseColor(json["colors"]["button_text_secondary_disabled"] as String)
..buttonTextBorderInt = ..buttonTextBorderInt =
parseColor(json["colors"]["button_text_border"] as String) parseColor(json["colors"]["button_text_border"] as String)
..buttonTextDisabledInt = ..buttonTextDisabledInt =
parseColor(json["colors"]["button_text_disabled"] as String) parseColor(json["colors"]["button_text_disabled"] as String)
..buttonTextBorderlessInt = ..buttonTextBorderlessInt =
parseColor(json["colors"]["button_text_borderless"] as String) parseColor(json["colors"]["button_text_borderless"] as String)
..buttonTextBorderlessDisabledInt = parseColor( ..buttonTextBorderlessDisabledInt = parseColor(
json["colors"]["button_text_borderless_disabled"] as String) json["colors"]["button_text_borderless_disabled"] as String)
..numberTextDefaultInt = ..numberTextDefaultInt =
parseColor(json["colors"]["number_text_default"] as String) parseColor(json["colors"]["number_text_default"] as String)
..numpadTextDefaultInt = ..numpadTextDefaultInt =
parseColor(json["colors"]["numpad_text_default"] as String) parseColor(json["colors"]["numpad_text_default"] as String)
..bottomNavTextInt = ..bottomNavTextInt =
parseColor(json["colors"]["bottom_nav_text"] as String) parseColor(json["colors"]["bottom_nav_text"] as String)
..customTextButtonEnabledTextInt = parseColor( ..customTextButtonEnabledTextInt = parseColor(
json["colors"]["custom_text_button_enabled_text"] as String) json["colors"]["custom_text_button_enabled_text"] as String)
..customTextButtonDisabledTextInt = parseColor( ..customTextButtonDisabledTextInt = parseColor(
@ -1635,87 +1635,87 @@ class StackTheme {
..switchBGOnInt = parseColor(json["colors"]["switch_bg_on"] as String) ..switchBGOnInt = parseColor(json["colors"]["switch_bg_on"] as String)
..switchBGOffInt = parseColor(json["colors"]["switch_bg_off"] as String) ..switchBGOffInt = parseColor(json["colors"]["switch_bg_off"] as String)
..switchBGDisabledInt = ..switchBGDisabledInt =
parseColor(json["colors"]["switch_bg_disabled"] as String) parseColor(json["colors"]["switch_bg_disabled"] as String)
..switchCircleOnInt = ..switchCircleOnInt =
parseColor(json["colors"]["switch_circle_on"] as String) parseColor(json["colors"]["switch_circle_on"] as String)
..switchCircleOffInt = ..switchCircleOffInt =
parseColor(json["colors"]["switch_circle_off"] as String) parseColor(json["colors"]["switch_circle_off"] as String)
..switchCircleDisabledInt = ..switchCircleDisabledInt =
parseColor(json["colors"]["switch_circle_disabled"] as String) parseColor(json["colors"]["switch_circle_disabled"] as String)
..stepIndicatorBGCheckInt = ..stepIndicatorBGCheckInt =
parseColor(json["colors"]["step_indicator_bg_check"] as String) parseColor(json["colors"]["step_indicator_bg_check"] as String)
..stepIndicatorBGNumberInt = ..stepIndicatorBGNumberInt =
parseColor(json["colors"]["step_indicator_bg_number"] as String) parseColor(json["colors"]["step_indicator_bg_number"] as String)
..stepIndicatorBGInactiveInt = ..stepIndicatorBGInactiveInt =
parseColor(json["colors"]["step_indicator_bg_inactive"] as String) parseColor(json["colors"]["step_indicator_bg_inactive"] as String)
..stepIndicatorBGLinesInt = ..stepIndicatorBGLinesInt =
parseColor(json["colors"]["step_indicator_bg_lines"] as String) parseColor(json["colors"]["step_indicator_bg_lines"] as String)
..stepIndicatorBGLinesInactiveInt = parseColor( ..stepIndicatorBGLinesInactiveInt = parseColor(
json["colors"]["step_indicator_bg_lines_inactive"] as String) json["colors"]["step_indicator_bg_lines_inactive"] as String)
..stepIndicatorIconTextInt = ..stepIndicatorIconTextInt =
parseColor(json["colors"]["step_indicator_icon_text"] as String) parseColor(json["colors"]["step_indicator_icon_text"] as String)
..stepIndicatorIconNumberInt = ..stepIndicatorIconNumberInt =
parseColor(json["colors"]["step_indicator_icon_number"] as String) parseColor(json["colors"]["step_indicator_icon_number"] as String)
..stepIndicatorIconInactiveInt = ..stepIndicatorIconInactiveInt =
parseColor(json["colors"]["step_indicator_icon_inactive"] as String) parseColor(json["colors"]["step_indicator_icon_inactive"] as String)
..checkboxBGCheckedInt = ..checkboxBGCheckedInt =
parseColor(json["colors"]["checkbox_bg_checked"] as String) parseColor(json["colors"]["checkbox_bg_checked"] as String)
..checkboxBorderEmptyInt = ..checkboxBorderEmptyInt =
parseColor(json["colors"]["checkbox_border_empty"] as String) parseColor(json["colors"]["checkbox_border_empty"] as String)
..checkboxBGDisabledInt = ..checkboxBGDisabledInt =
parseColor(json["colors"]["checkbox_bg_disabled"] as String) parseColor(json["colors"]["checkbox_bg_disabled"] as String)
..checkboxIconCheckedInt = ..checkboxIconCheckedInt =
parseColor(json["colors"]["checkbox_icon_checked"] as String) parseColor(json["colors"]["checkbox_icon_checked"] as String)
..checkboxIconDisabledInt = ..checkboxIconDisabledInt =
parseColor(json["colors"]["checkbox_icon_disabled"] as String) parseColor(json["colors"]["checkbox_icon_disabled"] as String)
..checkboxTextLabelInt = ..checkboxTextLabelInt =
parseColor(json["colors"]["checkbox_text_label"] as String) parseColor(json["colors"]["checkbox_text_label"] as String)
..snackBarBackSuccessInt = ..snackBarBackSuccessInt =
parseColor(json["colors"]["snack_bar_back_success"] as String) parseColor(json["colors"]["snack_bar_back_success"] as String)
..snackBarBackErrorInt = ..snackBarBackErrorInt =
parseColor(json["colors"]["snack_bar_back_error"] as String) parseColor(json["colors"]["snack_bar_back_error"] as String)
..snackBarBackInfoInt = ..snackBarBackInfoInt =
parseColor(json["colors"]["snack_bar_back_info"] as String) parseColor(json["colors"]["snack_bar_back_info"] as String)
..snackBarTextSuccessInt = ..snackBarTextSuccessInt =
parseColor(json["colors"]["snack_bar_text_success"] as String) parseColor(json["colors"]["snack_bar_text_success"] as String)
..snackBarTextErrorInt = ..snackBarTextErrorInt =
parseColor(json["colors"]["snack_bar_text_error"] as String) parseColor(json["colors"]["snack_bar_text_error"] as String)
..snackBarTextInfoInt = ..snackBarTextInfoInt =
parseColor(json["colors"]["snack_bar_text_info"] as String) parseColor(json["colors"]["snack_bar_text_info"] as String)
..bottomNavIconBackInt = ..bottomNavIconBackInt =
parseColor(json["colors"]["bottom_nav_icon_back"] as String) parseColor(json["colors"]["bottom_nav_icon_back"] as String)
..bottomNavIconIconInt = ..bottomNavIconIconInt =
parseColor(json["colors"]["bottom_nav_icon_icon"] as String) parseColor(json["colors"]["bottom_nav_icon_icon"] as String)
..bottomNavIconIconHighlightedInt = parseColor( ..bottomNavIconIconHighlightedInt = parseColor(
json["colors"]["bottom_nav_icon_icon_highlighted"] as String) json["colors"]["bottom_nav_icon_icon_highlighted"] as String)
..topNavIconPrimaryInt = ..topNavIconPrimaryInt =
parseColor(json["colors"]["top_nav_icon_primary"] as String) parseColor(json["colors"]["top_nav_icon_primary"] as String)
..topNavIconGreenInt = ..topNavIconGreenInt =
parseColor(json["colors"]["top_nav_icon_green"] as String) parseColor(json["colors"]["top_nav_icon_green"] as String)
..topNavIconYellowInt = ..topNavIconYellowInt =
parseColor(json["colors"]["top_nav_icon_yellow"] as String) parseColor(json["colors"]["top_nav_icon_yellow"] as String)
..topNavIconRedInt = ..topNavIconRedInt =
parseColor(json["colors"]["top_nav_icon_red"] as String) parseColor(json["colors"]["top_nav_icon_red"] as String)
..settingsIconBackInt = ..settingsIconBackInt =
parseColor(json["colors"]["settings_icon_back"] as String) parseColor(json["colors"]["settings_icon_back"] as String)
..settingsIconIconInt = ..settingsIconIconInt =
parseColor(json["colors"]["settings_icon_icon"] as String) parseColor(json["colors"]["settings_icon_icon"] as String)
..settingsIconBack2Int = ..settingsIconBack2Int =
parseColor(json["colors"]["settings_icon_back_two"] as String) parseColor(json["colors"]["settings_icon_back_two"] as String)
..settingsIconElementInt = ..settingsIconElementInt =
parseColor(json["colors"]["settings_icon_element"] as String) parseColor(json["colors"]["settings_icon_element"] as String)
..textFieldActiveBGInt = ..textFieldActiveBGInt =
parseColor(json["colors"]["text_field_active_bg"] as String) parseColor(json["colors"]["text_field_active_bg"] as String)
..textFieldDefaultBGInt = ..textFieldDefaultBGInt =
parseColor(json["colors"]["text_field_default_bg"] as String) parseColor(json["colors"]["text_field_default_bg"] as String)
..textFieldErrorBGInt = ..textFieldErrorBGInt =
parseColor(json["colors"]["text_field_error_bg"] as String) parseColor(json["colors"]["text_field_error_bg"] as String)
..textFieldSuccessBGInt = ..textFieldSuccessBGInt =
parseColor(json["colors"]["text_field_success_bg"] as String) parseColor(json["colors"]["text_field_success_bg"] as String)
..textFieldErrorBorderInt = ..textFieldErrorBorderInt =
parseColor(json["colors"]["text_field_error_border"] as String) parseColor(json["colors"]["text_field_error_border"] as String)
..textFieldSuccessBorderInt = ..textFieldSuccessBorderInt =
parseColor(json["colors"]["text_field_success_border"] as String) parseColor(json["colors"]["text_field_success_border"] as String)
..textFieldActiveSearchIconLeftInt = parseColor( ..textFieldActiveSearchIconLeftInt = parseColor(
json["colors"]["text_field_active_search_icon_left"] as String) json["colors"]["text_field_active_search_icon_left"] as String)
..textFieldDefaultSearchIconLeftInt = parseColor( ..textFieldDefaultSearchIconLeftInt = parseColor(
@ -1725,19 +1725,19 @@ class StackTheme {
..textFieldSuccessSearchIconLeftInt = parseColor( ..textFieldSuccessSearchIconLeftInt = parseColor(
json["colors"]["text_field_success_search_icon_left"] as String) json["colors"]["text_field_success_search_icon_left"] as String)
..textFieldActiveTextInt = ..textFieldActiveTextInt =
parseColor(json["colors"]["text_field_active_text"] as String) parseColor(json["colors"]["text_field_active_text"] as String)
..textFieldDefaultTextInt = ..textFieldDefaultTextInt =
parseColor(json["colors"]["text_field_default_text"] as String) parseColor(json["colors"]["text_field_default_text"] as String)
..textFieldErrorTextInt = ..textFieldErrorTextInt =
parseColor(json["colors"]["text_field_error_text"] as String) parseColor(json["colors"]["text_field_error_text"] as String)
..textFieldSuccessTextInt = ..textFieldSuccessTextInt =
parseColor(json["colors"]["text_field_success_text"] as String) parseColor(json["colors"]["text_field_success_text"] as String)
..textFieldActiveLabelInt = ..textFieldActiveLabelInt =
parseColor(json["colors"]["text_field_active_label"] as String) parseColor(json["colors"]["text_field_active_label"] as String)
..textFieldErrorLabelInt = ..textFieldErrorLabelInt =
parseColor(json["colors"]["text_field_error_label"] as String) parseColor(json["colors"]["text_field_error_label"] as String)
..textFieldSuccessLabelInt = ..textFieldSuccessLabelInt =
parseColor(json["colors"]["text_field_success_label"] as String) parseColor(json["colors"]["text_field_success_label"] as String)
..textFieldActiveSearchIconRightInt = parseColor( ..textFieldActiveSearchIconRightInt = parseColor(
json["colors"]["text_field_active_search_icon_right"] as String) json["colors"]["text_field_active_search_icon_right"] as String)
..textFieldDefaultSearchIconRightInt = parseColor( ..textFieldDefaultSearchIconRightInt = parseColor(
@ -1753,61 +1753,61 @@ class StackTheme {
..settingsItem2ActiveSubInt = parseColor( ..settingsItem2ActiveSubInt = parseColor(
json["colors"]["settings_item_level_two_active_sub"] as String) json["colors"]["settings_item_level_two_active_sub"] as String)
..radioButtonIconBorderInt = ..radioButtonIconBorderInt =
parseColor(json["colors"]["radio_button_icon_border"] as String) parseColor(json["colors"]["radio_button_icon_border"] as String)
..radioButtonIconBorderDisabledInt = parseColor( ..radioButtonIconBorderDisabledInt = parseColor(
json["colors"]["radio_button_icon_border_disabled"] as String) json["colors"]["radio_button_icon_border_disabled"] as String)
..radioButtonBorderEnabledInt = ..radioButtonBorderEnabledInt =
parseColor(json["colors"]["radio_button_border_enabled"] as String) parseColor(json["colors"]["radio_button_border_enabled"] as String)
..radioButtonBorderDisabledInt = ..radioButtonBorderDisabledInt =
parseColor(json["colors"]["radio_button_border_disabled"] as String) parseColor(json["colors"]["radio_button_border_disabled"] as String)
..radioButtonIconCircleInt = ..radioButtonIconCircleInt =
parseColor(json["colors"]["radio_button_icon_circle"] as String) parseColor(json["colors"]["radio_button_icon_circle"] as String)
..radioButtonIconEnabledInt = ..radioButtonIconEnabledInt =
parseColor(json["colors"]["radio_button_icon_enabled"] as String) parseColor(json["colors"]["radio_button_icon_enabled"] as String)
..radioButtonTextEnabledInt = ..radioButtonTextEnabledInt =
parseColor(json["colors"]["radio_button_text_enabled"] as String) parseColor(json["colors"]["radio_button_text_enabled"] as String)
..radioButtonTextDisabledInt = ..radioButtonTextDisabledInt =
parseColor(json["colors"]["radio_button_text_disabled"] as String) parseColor(json["colors"]["radio_button_text_disabled"] as String)
..radioButtonLabelEnabledInt = ..radioButtonLabelEnabledInt =
parseColor(json["colors"]["radio_button_label_enabled"] as String) parseColor(json["colors"]["radio_button_label_enabled"] as String)
..radioButtonLabelDisabledInt = ..radioButtonLabelDisabledInt =
parseColor(json["colors"]["radio_button_label_disabled"] as String) parseColor(json["colors"]["radio_button_label_disabled"] as String)
..infoItemBGInt = parseColor(json["colors"]["info_item_bg"] as String) ..infoItemBGInt = parseColor(json["colors"]["info_item_bg"] as String)
..infoItemLabelInt = ..infoItemLabelInt =
parseColor(json["colors"]["info_item_label"] as String) parseColor(json["colors"]["info_item_label"] as String)
..infoItemTextInt = parseColor(json["colors"]["info_item_text"] as String) ..infoItemTextInt = parseColor(json["colors"]["info_item_text"] as String)
..infoItemIconsInt = ..infoItemIconsInt =
parseColor(json["colors"]["info_item_icons"] as String) parseColor(json["colors"]["info_item_icons"] as String)
..popupBGInt = parseColor(json["colors"]["popup_bg"] as String) ..popupBGInt = parseColor(json["colors"]["popup_bg"] as String)
..currencyListItemBGInt = ..currencyListItemBGInt =
parseColor(json["colors"]["currency_list_item_bg"] as String) parseColor(json["colors"]["currency_list_item_bg"] as String)
..stackWalletBGInt = parseColor(json["colors"]["sw_bg"] as String) ..stackWalletBGInt = parseColor(json["colors"]["sw_bg"] as String)
..stackWalletMidInt = parseColor(json["colors"]["sw_mid"] as String) ..stackWalletMidInt = parseColor(json["colors"]["sw_mid"] as String)
..stackWalletBottomInt = parseColor(json["colors"]["sw_bottom"] as String) ..stackWalletBottomInt = parseColor(json["colors"]["sw_bottom"] as String)
..bottomNavShadowInt = ..bottomNavShadowInt =
parseColor(json["colors"]["bottom_nav_shadow"] as String) parseColor(json["colors"]["bottom_nav_shadow"] as String)
..splashInt = parseColor(json["colors"]["splash"] as String) ..splashInt = parseColor(json["colors"]["splash"] as String)
..highlightInt = parseColor(json["colors"]["highlight"] as String) ..highlightInt = parseColor(json["colors"]["highlight"] as String)
..warningForegroundInt = ..warningForegroundInt =
parseColor(json["colors"]["warning_foreground"] as String) parseColor(json["colors"]["warning_foreground"] as String)
..warningBackgroundInt = ..warningBackgroundInt =
parseColor(json["colors"]["warning_background"] as String) parseColor(json["colors"]["warning_background"] as String)
..loadingOverlayTextColorInt = ..loadingOverlayTextColorInt =
parseColor(json["colors"]["loading_overlay_text_color"] as String) parseColor(json["colors"]["loading_overlay_text_color"] as String)
..myStackContactIconBGInt = ..myStackContactIconBGInt =
parseColor(json["colors"]["my_stack_contact_icon_bg"] as String) parseColor(json["colors"]["my_stack_contact_icon_bg"] as String)
..textConfirmTotalAmountInt = ..textConfirmTotalAmountInt =
parseColor(json["colors"]["text_confirm_total_amount"] as String) parseColor(json["colors"]["text_confirm_total_amount"] as String)
..textSelectedWordTableItemInt = ..textSelectedWordTableItemInt =
parseColor(json["colors"]["text_selected_word_table_iterm"] as String) parseColor(json["colors"]["text_selected_word_table_iterm"] as String)
..favoriteStarActiveInt = ..favoriteStarActiveInt =
parseColor(json["colors"]["favorite_star_active"] as String) parseColor(json["colors"]["favorite_star_active"] as String)
..favoriteStarInactiveInt = ..favoriteStarInactiveInt =
parseColor(json["colors"]["favorite_star_inactive"] as String) parseColor(json["colors"]["favorite_star_inactive"] as String)
..rateTypeToggleColorOnInt = ..rateTypeToggleColorOnInt =
parseColor(json["colors"]["rate_type_toggle_color_on"] as String) parseColor(json["colors"]["rate_type_toggle_color_on"] as String)
..rateTypeToggleColorOffInt = ..rateTypeToggleColorOffInt =
parseColor(json["colors"]["rate_type_toggle_color_off"] as String) parseColor(json["colors"]["rate_type_toggle_color_off"] as String)
..rateTypeToggleDesktopColorOnInt = parseColor( ..rateTypeToggleDesktopColorOnInt = parseColor(
json["colors"]["rate_type_toggle_desktop_color_on"] as String) json["colors"]["rate_type_toggle_desktop_color_on"] as String)
..rateTypeToggleDesktopColorOffInt = parseColor( ..rateTypeToggleDesktopColorOffInt = parseColor(
@ -1815,19 +1815,19 @@ class StackTheme {
..ethTagTextInt = parseColor(json["colors"]["eth_tag_text"] as String) ..ethTagTextInt = parseColor(json["colors"]["eth_tag_text"] as String)
..ethTagBGInt = parseColor(json["colors"]["eth_tag_bg"] as String) ..ethTagBGInt = parseColor(json["colors"]["eth_tag_bg"] as String)
..ethWalletTagTextInt = ..ethWalletTagTextInt =
parseColor(json["colors"]["eth_wallet_tag_text"] as String) parseColor(json["colors"]["eth_wallet_tag_text"] as String)
..ethWalletTagBGInt = ..ethWalletTagBGInt =
parseColor(json["colors"]["eth_wallet_tag_bg"] as String) parseColor(json["colors"]["eth_wallet_tag_bg"] as String)
..tokenSummaryTextPrimaryInt = ..tokenSummaryTextPrimaryInt =
parseColor(json["colors"]["token_summary_text_primary"] as String) parseColor(json["colors"]["token_summary_text_primary"] as String)
..tokenSummaryTextSecondaryInt = ..tokenSummaryTextSecondaryInt =
parseColor(json["colors"]["token_summary_text_secondary"] as String) parseColor(json["colors"]["token_summary_text_secondary"] as String)
..tokenSummaryBGInt = ..tokenSummaryBGInt =
parseColor(json["colors"]["token_summary_bg"] as String) parseColor(json["colors"]["token_summary_bg"] as String)
..tokenSummaryButtonBGInt = ..tokenSummaryButtonBGInt =
parseColor(json["colors"]["token_summary_button_bg"] as String) parseColor(json["colors"]["token_summary_button_bg"] as String)
..tokenSummaryIconInt = ..tokenSummaryIconInt =
parseColor(json["colors"]["token_summary_icon"] as String); parseColor(json["colors"]["token_summary_icon"] as String);
} }
/// Grab the int value of the hex color string. /// Grab the int value of the hex color string.
@ -1840,7 +1840,7 @@ class StackTheme {
} else { } else {
throw ArgumentError( throw ArgumentError(
'"$colorHex" and corresponding int ' '"$colorHex" and corresponding int '
'value "$colorValue" is not a valid color.', 'value "$colorValue" is not a valid color.',
); );
} }
} catch (_) { } catch (_) {
@ -1857,13 +1857,16 @@ class StackTheme {
final Map<Coin, Color> result = {}; final Map<Coin, Color> result = {};
for (final coin in Coin.values) { for (final coin in Coin.values.map((e) => e.mainNetVersion)) {
if (map[coin.name] is String) { if (map[coin.name] is String) {
result[coin] = Color( result[coin] = Color(
(map[coin.name] as String).toBigIntFromHex.toInt(), (map[coin.name] as String).toBigIntFromHex.toInt(),
); );
} else { } else {
result[coin] = kCoinThemeColorDefaults.forCoin(coin); Logging.instance.log(
"Color not found in theme for $coin",
level: LogLevel.Error,
);
} }
} }
@ -2078,18 +2081,18 @@ class ThemeAssetsV2 implements IThemeAssets {
@ignore @ignore
Map<Coin, String> get coinIcons => _coinIcons ??= parseCoinAssetsString( Map<Coin, String> get coinIcons => _coinIcons ??= parseCoinAssetsString(
coinIconsString, coinIconsString,
placeHolder: coinPlaceholder, placeHolder: coinPlaceholder,
); );
@ignore @ignore
Map<Coin, String>? _coinIcons; Map<Coin, String>? _coinIcons;
late final String coinIconsString; late final String coinIconsString;
@ignore @ignore
Map<Coin, String> get coinImages => _coinImages ??= parseCoinAssetsString( Map<Coin, String> get coinImages => _coinImages ??= parseCoinAssetsString(
coinImagesString, coinImagesString,
placeHolder: coinPlaceholder, placeHolder: coinPlaceholder,
); );
@ignore @ignore
Map<Coin, String>? _coinImages; Map<Coin, String>? _coinImages;
late final String coinImagesString; late final String coinImagesString;
@ -2164,9 +2167,9 @@ class ThemeAssetsV2 implements IThemeAssets {
} }
static Map<Coin, String> parseCoinAssetsString( static Map<Coin, String> parseCoinAssetsString(
String jsonString, { String jsonString, {
required String placeHolder, required String placeHolder,
}) { }) {
final json = jsonDecode(jsonString) as Map; final json = jsonDecode(jsonString) as Map;
final map = Map<String, dynamic>.from(json); final map = Map<String, dynamic>.from(json);
@ -2348,18 +2351,18 @@ class ThemeAssetsV3 implements IThemeAssets {
@ignore @ignore
Map<Coin, String> get coinIcons => _coinIcons ??= parseCoinAssetsString( Map<Coin, String> get coinIcons => _coinIcons ??= parseCoinAssetsString(
coinIconsString, coinIconsString,
placeHolder: coinPlaceholder, placeHolder: coinPlaceholder,
); );
@ignore @ignore
Map<Coin, String>? _coinIcons; Map<Coin, String>? _coinIcons;
late final String coinIconsString; late final String coinIconsString;
@ignore @ignore
Map<Coin, String> get coinImages => _coinImages ??= parseCoinAssetsString( Map<Coin, String> get coinImages => _coinImages ??= parseCoinAssetsString(
coinImagesString, coinImagesString,
placeHolder: coinPlaceholder, placeHolder: coinPlaceholder,
); );
@ignore @ignore
Map<Coin, String>? _coinImages; Map<Coin, String>? _coinImages;
late final String coinImagesString; late final String coinImagesString;
@ -2379,9 +2382,9 @@ class ThemeAssetsV3 implements IThemeAssets {
_coinCardImages ??= coinCardImagesString == null _coinCardImages ??= coinCardImagesString == null
? null ? null
: parseCoinAssetsString( : parseCoinAssetsString(
coinCardImagesString!, coinCardImagesString!,
placeHolder: coinPlaceholder, placeHolder: coinPlaceholder,
); );
@ignore @ignore
Map<Coin, String>? _coinCardImages; Map<Coin, String>? _coinCardImages;
late final String? coinCardImagesString; late final String? coinCardImagesString;
@ -2391,9 +2394,9 @@ class ThemeAssetsV3 implements IThemeAssets {
_coinCardFavoritesImages ??= coinCardFavoritesImagesString == null _coinCardFavoritesImages ??= coinCardFavoritesImagesString == null
? null ? null
: parseCoinAssetsString( : parseCoinAssetsString(
coinCardFavoritesImagesString!, coinCardFavoritesImagesString!,
placeHolder: coinPlaceholder, placeHolder: coinPlaceholder,
); );
@ignore @ignore
Map<Coin, String>? _coinCardFavoritesImages; Map<Coin, String>? _coinCardFavoritesImages;
@Name("otherStringParam1") @Name("otherStringParam1")
@ -2450,15 +2453,15 @@ class ThemeAssetsV3 implements IThemeAssets {
) )
..coinCardImagesString = json["coins"]["cards"] is Map ..coinCardImagesString = json["coins"]["cards"] is Map
? createCoinAssetsString( ? createCoinAssetsString(
"$themeId/assets", "$themeId/assets",
Map<String, dynamic>.from(json["coins"]["cards"] as Map), Map<String, dynamic>.from(json["coins"]["cards"] as Map),
) )
: null : null
..coinCardFavoritesImagesString = json["coins"]["favoriteCards"] is Map ..coinCardFavoritesImagesString = json["coins"]["favoriteCards"] is Map
? createCoinAssetsString( ? createCoinAssetsString(
"$themeId/assets", "$themeId/assets",
Map<String, dynamic>.from(json["coins"]["favoriteCards"] as Map), Map<String, dynamic>.from(json["coins"]["favoriteCards"] as Map),
) )
: null : null
..loadingGifRelative = json["loading_gif"] is String ..loadingGifRelative = json["loading_gif"] is String
? "$themeId/assets/${json["loading_gif"] as String}" ? "$themeId/assets/${json["loading_gif"] as String}"
@ -2499,9 +2502,9 @@ class ThemeAssetsV3 implements IThemeAssets {
} }
static Map<Coin, String> parseCoinAssetsString( static Map<Coin, String> parseCoinAssetsString(
String jsonString, { String jsonString, {
required String placeHolder, required String placeHolder,
}) { }) {
final json = jsonDecode(jsonString) as Map; final json = jsonDecode(jsonString) as Map;
final map = Map<String, dynamic>.from(json); final map = Map<String, dynamic>.from(json);
@ -2571,4 +2574,4 @@ abstract class IThemeAssets {
String? get loadingGif; String? get loadingGif;
String? get background; String? get background;
} }

View file

@ -268,89 +268,6 @@ class _RestoreFrostMsWalletViewState
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const SizedBox(
height: 16,
),
ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
child: TextField(
key: const Key("frMyNameTextFieldKey"),
controller: keysFieldController,
onChanged: (_) {
setState(() {
_keysEmpty = keysFieldController.text.isEmpty;
});
},
focusNode: keysFocusNode,
readOnly: false,
autocorrect: false,
enableSuggestions: false,
style: STextStyles.field(context),
decoration: standardInputDecoration(
"Keys",
keysFocusNode,
context,
).copyWith(
contentPadding: const EdgeInsets.only(
left: 16,
top: 6,
bottom: 8,
right: 5,
),
suffixIcon: Padding(
padding: _keysEmpty
? const EdgeInsets.only(right: 8)
: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
!_keysEmpty
? TextFieldIconButton(
semanticsLabel:
"Clear Button. Clears The Keys Field.",
key: const Key("frMyNameClearButtonKey"),
onTap: () {
keysFieldController.text = "";
setState(() {
_keysEmpty = true;
});
},
child: const XIcon(),
)
: TextFieldIconButton(
semanticsLabel:
"Paste Button. Pastes From Clipboard To Keys Field.",
key: const Key("frKeysPasteButtonKey"),
onTap: () async {
final ClipboardData? data =
await Clipboard.getData(
Clipboard.kTextPlain);
if (data?.text != null &&
data!.text!.isNotEmpty) {
keysFieldController.text =
data.text!.trim();
}
setState(() {
_keysEmpty =
keysFieldController.text.isEmpty;
});
},
child: _keysEmpty
? const ClipboardIcon()
: const XIcon(),
),
],
),
),
),
),
),
),
const SizedBox( const SizedBox(
height: 16, height: 16,
), ),
@ -411,7 +328,8 @@ class _RestoreFrostMsWalletViewState
onTap: () async { onTap: () async {
final ClipboardData? data = final ClipboardData? data =
await Clipboard.getData( await Clipboard.getData(
Clipboard.kTextPlain); Clipboard.kTextPlain,
);
if (data?.text != null && if (data?.text != null &&
data!.text!.isNotEmpty) { data!.text!.isNotEmpty) {
configFieldController.text = configFieldController.text =
@ -437,7 +355,8 @@ class _RestoreFrostMsWalletViewState
if (FocusScope.of(context).hasFocus) { if (FocusScope.of(context).hasFocus) {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
await Future<void>.delayed( await Future<void>.delayed(
const Duration(milliseconds: 75)); const Duration(milliseconds: 75),
);
} }
final qrResult = await BarcodeScanner.scan(); final qrResult = await BarcodeScanner.scan();
@ -457,7 +376,91 @@ class _RestoreFrostMsWalletViewState
} }
}, },
child: const QrCodeIcon(), child: const QrCodeIcon(),
) ),
],
),
),
),
),
),
),
const SizedBox(
height: 16,
),
ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
child: TextField(
key: const Key("frMyNameTextFieldKey"),
controller: keysFieldController,
onChanged: (_) {
setState(() {
_keysEmpty = keysFieldController.text.isEmpty;
});
},
focusNode: keysFocusNode,
readOnly: false,
autocorrect: false,
enableSuggestions: false,
style: STextStyles.field(context),
decoration: standardInputDecoration(
"Keys",
keysFocusNode,
context,
).copyWith(
contentPadding: const EdgeInsets.only(
left: 16,
top: 6,
bottom: 8,
right: 5,
),
suffixIcon: Padding(
padding: _keysEmpty
? const EdgeInsets.only(right: 8)
: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
!_keysEmpty
? TextFieldIconButton(
semanticsLabel:
"Clear Button. Clears The Keys Field.",
key: const Key("frMyNameClearButtonKey"),
onTap: () {
keysFieldController.text = "";
setState(() {
_keysEmpty = true;
});
},
child: const XIcon(),
)
: TextFieldIconButton(
semanticsLabel:
"Paste Button. Pastes From Clipboard To Keys Field.",
key: const Key("frKeysPasteButtonKey"),
onTap: () async {
final ClipboardData? data =
await Clipboard.getData(
Clipboard.kTextPlain,
);
if (data?.text != null &&
data!.text!.isNotEmpty) {
keysFieldController.text =
data.text!.trim();
}
setState(() {
_keysEmpty =
keysFieldController.text.isEmpty;
});
},
child: _keysEmpty
? const ClipboardIcon()
: const XIcon(),
),
], ],
), ),
), ),

View file

@ -31,6 +31,7 @@ import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart'; import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
import 'package:stackwallet/wallets/wallet/wallet.dart'; import 'package:stackwallet/wallets/wallet/wallet.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart'; import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart'; import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
@ -180,152 +181,171 @@ class _NewWalletRecoveryPhraseViewState
child: Padding( child: Padding(
padding: padding:
isDesktop ? const EdgeInsets.all(0) : const EdgeInsets.all(16), isDesktop ? const EdgeInsets.all(0) : const EdgeInsets.all(16),
child: Column( child: ConditionalParent(
crossAxisAlignment: CrossAxisAlignment.stretch, condition: Util.isDesktop,
children: [ builder: (child) => LayoutBuilder(
if (isDesktop) builder: (context, constraints) {
const Spacer( return SingleChildScrollView(
flex: 10, child: ConstrainedBox(
), constraints: BoxConstraints(
if (!isDesktop) minHeight: constraints.maxHeight,
const SizedBox( ),
height: 4, child: IntrinsicHeight(
), child: child,
if (!isDesktop) ),
Text(
ref.watch(pWalletName(_wallet.walletId)),
textAlign: TextAlign.center,
style: STextStyles.label(context).copyWith(
fontSize: 12,
), ),
), );
SizedBox( },
height: isDesktop ? 24 : 4, ),
), child: Column(
Text( crossAxisAlignment: CrossAxisAlignment.stretch,
"Recovery Phrase", children: [
textAlign: TextAlign.center, if (isDesktop)
style: isDesktop const Spacer(
? STextStyles.desktopH2(context) flex: 10,
: STextStyles.pageTitleH1(context), ),
), if (!isDesktop)
const SizedBox( const SizedBox(
height: 16, height: 4,
), ),
Container( if (!isDesktop)
decoration: BoxDecoration( Text(
color: isDesktop ref.watch(pWalletName(_wallet.walletId)),
? Theme.of(context).extension<StackColors>()!.background
: Theme.of(context).extension<StackColors>()!.popupBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius),
),
child: Padding(
padding: isDesktop
? const EdgeInsets.all(0)
: const EdgeInsets.all(12),
child: Text(
"Please write down your recovery phrase in the correct order and save it to keep your funds secure. You will also be asked to verify the words on the next screen.",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: isDesktop style: STextStyles.label(context).copyWith(
? STextStyles.desktopSubtitleH2(context) fontSize: 12,
: STextStyles.label(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark),
),
),
),
SizedBox(
height: isDesktop ? 21 : 8,
),
if (!isDesktop)
Expanded(
child: SingleChildScrollView(
child: MnemonicTable(
words: _mnemonic,
isDesktop: isDesktop,
), ),
), ),
),
if (isDesktop)
MnemonicTable(
words: _mnemonic,
isDesktop: isDesktop,
),
SizedBox(
height: isDesktop ? 24 : 16,
),
if (isDesktop)
SizedBox( SizedBox(
height: 70, height: isDesktop ? 24 : 4,
child: TextButton( ),
onPressed: () async { Text(
await _copy(); "Recovery Phrase",
}, textAlign: TextAlign.center,
child: Row( style: isDesktop
mainAxisAlignment: MainAxisAlignment.center, ? STextStyles.desktopH2(context)
children: [ : STextStyles.pageTitleH1(context),
SvgPicture.asset(
Assets.svg.copy,
width: 20,
height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.buttonTextSecondary,
),
const SizedBox(
width: 10,
),
Text(
"Copy to clipboard",
style: STextStyles.desktopButtonSecondaryEnabled(
context),
)
],
),
),
), ),
if (isDesktop)
const SizedBox( const SizedBox(
height: 16, height: 16,
), ),
ConstrainedBox( Container(
constraints: BoxConstraints( decoration: BoxDecoration(
minHeight: isDesktop ? 70 : 0, color: isDesktop
), ? Theme.of(context)
child: TextButton( .extension<StackColors>()!
onPressed: () async { .background
final int next = Random().nextInt(_mnemonic.length); : Theme.of(context).extension<StackColors>()!.popupBG,
ref borderRadius: BorderRadius.circular(
.read(verifyMnemonicWordIndexStateProvider.state) Constants.size.circularBorderRadius),
.update((state) => next); ),
child: Padding(
ref padding: isDesktop
.read(verifyMnemonicCorrectWordStateProvider.state) ? const EdgeInsets.all(0)
.update((state) => _mnemonic[next]); : const EdgeInsets.all(12),
child: Text(
unawaited(Navigator.of(context).pushNamed( "Please write down your recovery phrase in the correct order and save it to keep your funds secure. You will also be asked to verify the words on the next screen.",
VerifyRecoveryPhraseView.routeName, textAlign: TextAlign.center,
arguments: Tuple2(_wallet, _mnemonic), style: isDesktop
)); ? STextStyles.desktopSubtitleH2(context)
}, : STextStyles.label(context).copyWith(
style: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.getPrimaryEnabledButtonStyle(context), .accentColorDark),
child: Text( ),
"I saved my recovery phrase",
style: isDesktop
? STextStyles.desktopButtonEnabled(context)
: STextStyles.button(context),
), ),
), ),
), SizedBox(
if (isDesktop) height: isDesktop ? 21 : 8,
const Spacer(
flex: 15,
), ),
], if (!isDesktop)
Expanded(
child: SingleChildScrollView(
child: MnemonicTable(
words: _mnemonic,
isDesktop: isDesktop,
),
),
),
if (isDesktop)
MnemonicTable(
words: _mnemonic,
isDesktop: isDesktop,
),
SizedBox(
height: isDesktop ? 24 : 16,
),
if (isDesktop)
SizedBox(
height: 70,
child: TextButton(
onPressed: () async {
await _copy();
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
Assets.svg.copy,
width: 20,
height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.buttonTextSecondary,
),
const SizedBox(
width: 10,
),
Text(
"Copy to clipboard",
style: STextStyles.desktopButtonSecondaryEnabled(
context),
)
],
),
),
),
if (isDesktop)
const SizedBox(
height: 16,
),
ConstrainedBox(
constraints: BoxConstraints(
minHeight: isDesktop ? 70 : 0,
),
child: TextButton(
onPressed: () async {
final int next = Random().nextInt(_mnemonic.length);
ref
.read(verifyMnemonicWordIndexStateProvider.state)
.update((state) => next);
ref
.read(verifyMnemonicCorrectWordStateProvider.state)
.update((state) => _mnemonic[next]);
unawaited(Navigator.of(context).pushNamed(
VerifyRecoveryPhraseView.routeName,
arguments: Tuple2(_wallet, _mnemonic),
));
},
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonStyle(context),
child: Text(
"I saved my recovery phrase",
style: isDesktop
? STextStyles.desktopButtonEnabled(context)
: STextStyles.button(context),
),
),
),
if (isDesktop)
const Spacer(
flex: 15,
),
],
),
), ),
), ),
), ),

View file

@ -17,6 +17,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart'; import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart'; import 'package:stackwallet/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart';
import 'package:stackwallet/pages/home_view/home_view.dart'; import 'package:stackwallet/pages/home_view/home_view.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart';
import 'package:stackwallet/providers/global/secure_store_provider.dart'; import 'package:stackwallet/providers/global/secure_store_provider.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart'; import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/stack_colors.dart';
@ -24,23 +25,35 @@ import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart'; import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart'; import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/detail_item.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:stackwallet/widgets/stack_dialog.dart'; import 'package:stackwallet/widgets/stack_dialog.dart';
class DeleteWalletRecoveryPhraseView extends ConsumerStatefulWidget { class DeleteWalletRecoveryPhraseView extends ConsumerStatefulWidget {
const DeleteWalletRecoveryPhraseView({ const DeleteWalletRecoveryPhraseView({
Key? key, super.key,
required this.walletId, required this.walletId,
required this.mnemonic, required this.mnemonic,
this.frostWalletData,
this.clipboardInterface = const ClipboardWrapper(), this.clipboardInterface = const ClipboardWrapper(),
}) : super(key: key); });
static const routeName = "/deleteWalletRecoveryPhrase"; static const routeName = "/deleteWalletRecoveryPhrase";
final String walletId; final String walletId;
final List<String> mnemonic; final List<String> mnemonic;
final ({
String myName,
String config,
String keys,
({String config, String keys})? prevGen,
})? frostWalletData;
final ClipboardInterface clipboardInterface; final ClipboardInterface clipboardInterface;
@ -54,6 +67,62 @@ class _DeleteWalletRecoveryPhraseViewState
late List<String> _mnemonic; late List<String> _mnemonic;
late ClipboardInterface _clipboardInterface; late ClipboardInterface _clipboardInterface;
bool _lock = false;
void _continuePressed() {
if (_lock) {
return;
}
_lock = true;
try {
showDialog<dynamic>(
barrierDismissible: true,
context: context,
builder: (_) => StackDialog(
title: "Thanks! Your wallet will be deleted.",
leftButton: TextButton(
style: Theme.of(context)
.extension<StackColors>()!
.getSecondaryEnabledButtonStyle(context),
onPressed: () {
Navigator.pop(context);
},
child: Text(
"Cancel",
style: STextStyles.button(context).copyWith(
color:
Theme.of(context).extension<StackColors>()!.accentColorDark,
),
),
),
rightButton: TextButton(
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonStyle(context),
onPressed: () async {
await ref.read(pWallets).deleteWallet(
ref.read(pWalletInfo(widget.walletId)),
ref.read(secureStoreProvider),
);
if (mounted) {
Navigator.of(context).popUntil(
ModalRoute.withName(HomeView.routeName),
);
}
},
child: Text(
"Ok",
style: STextStyles.button(context),
),
),
),
);
} finally {
_lock = false;
}
}
@override @override
void initState() { void initState() {
_mnemonic = widget.mnemonic; _mnemonic = widget.mnemonic;
@ -65,6 +134,9 @@ class _DeleteWalletRecoveryPhraseViewState
Widget build(BuildContext context) { Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType"); debugPrint("BUILD: $runtimeType");
final bool frost = widget.frostWalletData != null;
final prevGen = widget.frostWalletData?.prevGen != null;
return Background( return Background(
child: Scaffold( child: Scaffold(
backgroundColor: Theme.of(context).extension<StackColors>()!.background, backgroundColor: Theme.of(context).extension<StackColors>()!.background,
@ -93,7 +165,7 @@ class _DeleteWalletRecoveryPhraseViewState
onPressed: () async { onPressed: () async {
await _clipboardInterface await _clipboardInterface
.setData(ClipboardData(text: _mnemonic.join(" "))); .setData(ClipboardData(text: _mnemonic.join(" ")));
if (mounted) { if (context.mounted) {
unawaited( unawaited(
showFloatingFlushBar( showFloatingFlushBar(
type: FlushBarType.info, type: FlushBarType.info,
@ -111,116 +183,207 @@ class _DeleteWalletRecoveryPhraseViewState
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: Column( child: frost
crossAxisAlignment: CrossAxisAlignment.stretch, ? LayoutBuilder(
children: [ builder: (builderContext, constraints) {
const SizedBox( return SingleChildScrollView(
height: 4, child: ConstrainedBox(
), constraints: BoxConstraints(
Text( minHeight: constraints.maxHeight,
ref.watch(pWalletName(widget.walletId)), ),
textAlign: TextAlign.center, child: IntrinsicHeight(
style: STextStyles.label(context).copyWith( child: Column(
fontSize: 12, crossAxisAlignment: CrossAxisAlignment.stretch,
), children: [
), RoundedWhiteContainer(
const SizedBox( child: Text(
height: 4, "Please write down your backup data. Keep it safe and "
), "never share it with anyone. "
Text( "Your backup data is the only way you can access your "
"Recovery Phrase", "funds if you forget your PIN, lose your phone, etc."
textAlign: TextAlign.center, "\n\n"
style: STextStyles.pageTitleH1(context), "Stack Wallet does not keep nor is able to restore "
), "your backup data. "
const SizedBox( "Only you have access to your wallet.",
height: 16, style: STextStyles.label(context),
), ),
Container( ),
decoration: BoxDecoration( const SizedBox(
color: Theme.of(context).extension<StackColors>()!.popupBG, height: 24,
borderRadius: BorderRadius.circular( ),
Constants.size.circularBorderRadius), // DetailItem(
), // title: "My name",
child: Padding( // detail: frostWalletData!.myName,
padding: const EdgeInsets.all(12), // button: Util.isDesktop
child: Text( // ? IconCopyButton(
"Please write down your recovery phrase in the correct order and save it to keep your funds secure. You will also be asked to verify the words on the next screen.", // data: frostWalletData!.myName,
style: STextStyles.label(context).copyWith( // )
color: Theme.of(context) // : SimpleCopyButton(
.extension<StackColors>()! // data: frostWalletData!.myName,
.accentColorDark), // ),
), // ),
), // const SizedBox(
), // height: 16,
const SizedBox( // ),
height: 8, DetailItem(
), title: "Multisig config",
Expanded( detail: widget.frostWalletData!.config,
child: SingleChildScrollView( button: Util.isDesktop
child: MnemonicTable( ? IconCopyButton(
words: _mnemonic, data: widget.frostWalletData!.config,
isDesktop: false, )
), : SimpleCopyButton(
), data: widget.frostWalletData!.config,
), ),
const SizedBox( ),
height: 16, const SizedBox(
), height: 16,
TextButton( ),
style: Theme.of(context) DetailItem(
.extension<StackColors>()! title: "Keys",
.getPrimaryEnabledButtonStyle(context), detail: widget.frostWalletData!.keys,
onPressed: () { button: Util.isDesktop
showDialog<dynamic>( ? IconCopyButton(
barrierDismissible: true, data: widget.frostWalletData!.keys,
context: context, )
builder: (_) => StackDialog( : SimpleCopyButton(
title: "Thanks! Your wallet will be deleted.", data: widget.frostWalletData!.keys,
leftButton: TextButton( ),
style: Theme.of(context) ),
.extension<StackColors>()! if (prevGen)
.getSecondaryEnabledButtonStyle(context), const SizedBox(
onPressed: () { height: 24,
Navigator.pop(context); ),
}, if (prevGen)
child: Text( RoundedWhiteContainer(
"Cancel", child: Text(
style: STextStyles.button(context).copyWith( "Previous generation info",
color: Theme.of(context) style: STextStyles.label(context),
.extension<StackColors>()! ),
.accentColorDark), ),
if (prevGen)
const SizedBox(
height: 12,
),
if (prevGen)
DetailItem(
title: "Previous multisig config",
detail:
widget.frostWalletData!.prevGen!.config,
button: Util.isDesktop
? IconCopyButton(
data: widget
.frostWalletData!.prevGen!.config,
)
: SimpleCopyButton(
data: widget
.frostWalletData!.prevGen!.config,
),
),
if (prevGen)
const SizedBox(
height: 16,
),
if (prevGen)
DetailItem(
title: "Previous keys",
detail: widget.frostWalletData!.prevGen!.keys,
button: Util.isDesktop
? IconCopyButton(
data: widget
.frostWalletData!.prevGen!.keys,
)
: SimpleCopyButton(
data: widget
.frostWalletData!.prevGen!.keys,
),
),
const Spacer(),
const SizedBox(
height: 16,
),
PrimaryButton(
label: "Continue",
onPressed: _continuePressed,
),
],
),
), ),
), ),
rightButton: TextButton( );
style: Theme.of(context) },
.extension<StackColors>()! )
.getPrimaryEnabledButtonStyle(context), : Column(
onPressed: () async { crossAxisAlignment: CrossAxisAlignment.stretch,
await ref.read(pWallets).deleteWallet( children: [
ref.read(pWalletInfo(widget.walletId)), const SizedBox(
ref.read(secureStoreProvider), height: 4,
); ),
Text(
if (mounted) { ref.watch(pWalletName(widget.walletId)),
Navigator.of(context).popUntil( textAlign: TextAlign.center,
ModalRoute.withName(HomeView.routeName)); style: STextStyles.label(context).copyWith(
} fontSize: 12,
}, ),
),
const SizedBox(
height: 4,
),
Text(
"Recovery Phrase",
textAlign: TextAlign.center,
style: STextStyles.pageTitleH1(context),
),
const SizedBox(
height: 16,
),
Container(
decoration: BoxDecoration(
color:
Theme.of(context).extension<StackColors>()!.popupBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
child: Padding(
padding: const EdgeInsets.all(12),
child: Text( child: Text(
"Ok", "Please write down your recovery phrase in the correct order and save it to keep your funds secure. You will also be asked to verify the words on the next screen.",
style: STextStyles.button(context), style: STextStyles.label(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
), ),
), ),
), ),
); const SizedBox(
}, height: 8,
child: Text( ),
"Continue", Expanded(
style: STextStyles.button(context), child: SingleChildScrollView(
child: MnemonicTable(
words: _mnemonic,
isDesktop: false,
),
),
),
const SizedBox(
height: 16,
),
TextButton(
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonStyle(context),
onPressed: _continuePressed,
child: Text(
"Continue",
style: STextStyles.button(context),
),
),
],
), ),
),
],
),
), ),
), ),
); );

View file

@ -14,6 +14,7 @@ import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_set
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/wallets/wallet/impl/bitcoin_frost_wallet.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart'; import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
@ -21,9 +22,9 @@ import 'package:stackwallet/widgets/rounded_container.dart';
class DeleteWalletWarningView extends ConsumerWidget { class DeleteWalletWarningView extends ConsumerWidget {
const DeleteWalletWarningView({ const DeleteWalletWarningView({
Key? key, super.key,
required this.walletId, required this.walletId,
}) : super(key: key); });
static const String routeName = "/deleteWalletWarning"; static const String routeName = "/deleteWalletWarning";
@ -100,14 +101,50 @@ class DeleteWalletWarningView extends ConsumerWidget {
.getPrimaryEnabledButtonStyle(context), .getPrimaryEnabledButtonStyle(context),
onPressed: () async { onPressed: () async {
final wallet = ref.read(pWallets).getWallet(walletId); final wallet = ref.read(pWallets).getWallet(walletId);
final mnemonic =
await (wallet as MnemonicInterface).getMnemonicAsWords(); // TODO: [prio=med] take wallets that don't have a mnemonic into account
List<String>? mnemonic;
({
String myName,
String config,
String keys,
({String config, String keys})? prevGen,
})? frostWalletData;
if (wallet is BitcoinFrostWallet) {
final futures = [
wallet.getSerializedKeys(),
wallet.getMultisigConfig(),
wallet.getSerializedKeysPrevGen(),
wallet.getMultisigConfigPrevGen(),
];
final results = await Future.wait(futures);
if (results.length == 4) {
frostWalletData = (
myName: wallet.frostInfo.myName,
config: results[1]!,
keys: results[0]!,
prevGen: results[2] == null || results[3] == null
? null
: (
config: results[3]!,
keys: results[2]!,
),
);
}
} else if (wallet is MnemonicInterface) {
mnemonic = await wallet.getMnemonicAsWords();
}
if (context.mounted) { if (context.mounted) {
await Navigator.of(context).pushNamed( await Navigator.of(context).pushNamed(
DeleteWalletRecoveryPhraseView.routeName, DeleteWalletRecoveryPhraseView.routeName,
arguments: ( arguments: (
walletId: walletId, walletId: walletId,
mnemonicWords: mnemonic, mnemonicWords: mnemonic ?? [],
frostWalletData: frostWalletData,
), ),
); );
} }

View file

@ -122,9 +122,10 @@ class WalletSettingsWalletSettingsView extends ConsumerWidget {
child: Text( child: Text(
"Cancel", "Cancel",
style: STextStyles.button(context).copyWith( style: STextStyles.button(context).copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.accentColorDark), .accentColorDark,
),
), ),
), ),
rightButton: TextButton( rightButton: TextButton(
@ -150,7 +151,8 @@ class WalletSettingsWalletSettingsView extends ConsumerWidget {
"Delete wallet", "Delete wallet",
), ),
settings: const RouteSettings( settings: const RouteSettings(
name: "/deleteWalletLockscreen"), name: "/deleteWalletLockscreen",
),
), ),
); );
}, },

View file

@ -15,7 +15,7 @@ import 'package:stackwallet/widgets/coin_card.dart';
class WalletSummary extends StatelessWidget { class WalletSummary extends StatelessWidget {
const WalletSummary({ const WalletSummary({
Key? key, super.key,
required this.walletId, required this.walletId,
required this.initialSyncStatus, required this.initialSyncStatus,
this.aspectRatio = 2.0, this.aspectRatio = 2.0,
@ -23,7 +23,7 @@ class WalletSummary extends StatelessWidget {
this.minWidth = 200.0, this.minWidth = 200.0,
this.maxHeight = 250.0, this.maxHeight = 250.0,
this.maxWidth = 400.0, this.maxWidth = 400.0,
}) : super(key: key); });
final String walletId; final String walletId;
final WalletSyncStatus initialSyncStatus; final WalletSyncStatus initialSyncStatus;

View file

@ -63,18 +63,21 @@ class WalletSummaryInfo extends ConsumerWidget {
debugPrint("BUILD: $runtimeType"); debugPrint("BUILD: $runtimeType");
final externalCalls = ref.watch( final externalCalls = ref.watch(
prefsChangeNotifierProvider.select((value) => value.externalCalls)); prefsChangeNotifierProvider.select((value) => value.externalCalls),
);
final coin = ref.watch(pWalletCoin(walletId)); final coin = ref.watch(pWalletCoin(walletId));
final balance = ref.watch(pWalletBalance(walletId)); final balance = ref.watch(pWalletBalance(walletId));
final locale = ref.watch( final locale = ref.watch(
localeServiceChangeNotifierProvider.select((value) => value.locale)); localeServiceChangeNotifierProvider.select((value) => value.locale),
);
final baseCurrency = ref final baseCurrency = ref
.watch(prefsChangeNotifierProvider.select((value) => value.currency)); .watch(prefsChangeNotifierProvider.select((value) => value.currency));
final priceTuple = ref.watch(priceAnd24hChangeNotifierProvider final priceTuple = ref.watch(
.select((value) => value.getPrice(coin))); priceAnd24hChangeNotifierProvider.select((value) => value.getPrice(coin)),
);
final _showAvailable = final _showAvailable =
ref.watch(walletBalanceToggleStateProvider.state).state == ref.watch(walletBalanceToggleStateProvider.state).state ==
@ -206,7 +209,7 @@ class WalletSummaryInfo extends ConsumerWidget {
initialSyncStatus: initialSyncStatus, initialSyncStatus: initialSyncStatus,
), ),
], ],
) ),
], ],
), ),
); );

View file

@ -99,11 +99,11 @@ import 'package:tuple/tuple.dart';
/// [eventBus] should only be set during testing /// [eventBus] should only be set during testing
class WalletView extends ConsumerStatefulWidget { class WalletView extends ConsumerStatefulWidget {
const WalletView({ const WalletView({
Key? key, super.key,
required this.walletId, required this.walletId,
this.eventBus, this.eventBus,
this.clipboardInterface = const ClipboardWrapper(), this.clipboardInterface = const ClipboardWrapper(),
}) : super(key: key); });
static const String routeName = "/wallet"; static const String routeName = "/wallet";
static const double navBarHeight = 65.0; static const double navBarHeight = 65.0;

View file

@ -1745,6 +1745,27 @@ class RouteGenerator {
name: settings.name, name: settings.name,
), ),
); );
} else if (args is ({
String walletId,
List<String> mnemonicWords,
({
String myName,
String config,
String keys,
({String config, String keys})? prevGen,
})? frostWalletData,
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DeleteWalletRecoveryPhraseView(
mnemonic: args.mnemonicWords,
walletId: args.walletId,
frostWalletData: args.frostWalletData,
),
settings: RouteSettings(
name: settings.name,
),
);
} }
return _routeError("${settings.name} invalid args: ${args.toString()}"); return _routeError("${settings.name} invalid args: ${args.toString()}");

View file

@ -8,10 +8,12 @@
* *
*/ */
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/models/isar/stack_theme.dart'; import 'package:stackwallet/models/isar/stack_theme.dart';
import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/theme_service.dart'; import 'package:stackwallet/themes/theme_service.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
final applicationThemesDirectoryPathProvider = StateProvider((ref) => ""); final applicationThemesDirectoryPathProvider = StateProvider((ref) => "");
@ -38,3 +40,11 @@ final themeAssetsProvider = StateProvider<IThemeAssets>(
), ),
), ),
); );
final pCoinColor = StateProvider.family<Color, Coin>(
(ref, coin) =>
ref.watch(
themeProvider.select((value) => value.coinColors[coin.mainNetVersion]),
) ??
Colors.deepOrangeAccent,
);

View file

@ -29,7 +29,7 @@ final pThemeService = Provider<ThemeService>((ref) {
}); });
class ThemeService { class ThemeService {
static const _currentDefaultThemeVersion = 9; static const _currentDefaultThemeVersion = 10;
ThemeService._(); ThemeService._();
static ThemeService? _instance; static ThemeService? _instance;
static ThemeService get instance => _instance ??= ThemeService._(); static ThemeService get instance => _instance ??= ThemeService._();

View file

@ -14,7 +14,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/themes/coin_card_provider.dart'; import 'package:stackwallet/themes/coin_card_provider.dart';
import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/theme_providers.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart'; import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
@ -68,9 +68,7 @@ class CoinCard extends ConsumerWidget {
width: width, width: width,
height: height, height: height,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context) color: ref.watch(pCoinColor(coin)),
.extension<StackColors>()!
.colorForCoin(coin),
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius, Constants.size.circularBorderRadius,
), ),

View file

@ -153,12 +153,15 @@ class _FrostStepQrDialogState extends State<FrostStepQrDialog> {
child: QrImageView( child: QrImageView(
data: widget.data, data: widget.data,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
dataModuleStyle: QrDataModuleStyle( foregroundColor: Theme.of(context)
dataModuleShape: QrDataModuleShape.square, .extension<StackColors>()!
color: Theme.of(context) .accentColorDark,
.extension<StackColors>()! // dataModuleStyle: QrDataModuleStyle(
.accentColorDark, // dataModuleShape: QrDataModuleShape.square,
), // color: Theme.of(context)
// .extension<StackColors>()!
// .accentColorDark,
// ),
), ),
), ),
), ),