fix: added missing assets to theme and updated more references to use theme provided assets

This commit is contained in:
julian 2023-05-09 10:51:30 -06:00
parent e92501c38d
commit 7da7302e63
8 changed files with 109 additions and 79 deletions

View file

@ -1984,6 +1984,7 @@ class StackTheme {
class ThemeAssets { class ThemeAssets {
final String bellNew; final String bellNew;
final String buy; final String buy;
final String exchange;
final String personaIncognito; final String personaIncognito;
final String personaEasy; final String personaEasy;
final String stack; final String stack;
@ -2031,12 +2032,14 @@ class ThemeAssets {
final String wowneroImageSecondary; final String wowneroImageSecondary;
final String namecoinImageSecondary; final String namecoinImageSecondary;
final String particlImageSecondary; final String particlImageSecondary;
final String? loadingGif;
// todo: add all assets expected in json // todo: add all assets expected in json
ThemeAssets({ ThemeAssets({
required this.bellNew, required this.bellNew,
required this.buy, required this.buy,
required this.exchange,
required this.personaIncognito, required this.personaIncognito,
required this.personaEasy, required this.personaEasy,
required this.stack, required this.stack,
@ -2084,6 +2087,7 @@ class ThemeAssets {
required this.wowneroImageSecondary, required this.wowneroImageSecondary,
required this.namecoinImageSecondary, required this.namecoinImageSecondary,
required this.particlImageSecondary, required this.particlImageSecondary,
required this.loadingGif,
}); });
factory ThemeAssets.fromJson({ factory ThemeAssets.fromJson({
@ -2096,6 +2100,8 @@ class ThemeAssets {
"$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["bell_new"] as String}", "$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["bell_new"] as String}",
buy: buy:
"$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["buy"] as String}", "$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["buy"] as String}",
exchange:
"$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["exchange"] as String}",
personaIncognito: personaIncognito:
"$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["persona_incognito"] as String}", "$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["persona_incognito"] as String}",
personaEasy: personaEasy:
@ -2190,6 +2196,9 @@ class ThemeAssets {
"$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["namecoinImageSecondary"] as String}", "$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["namecoinImageSecondary"] as String}",
particlImageSecondary: particlImageSecondary:
"$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["particlImageSecondary"] as String}", "$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["particlImageSecondary"] as String}",
loadingGif: json["assets"]["loadingGif"] is String
? "$applicationThemesDirectoryPath/$internalThemeUuid/${json["assets"]["loadingGif"] as String}"
: null,
); );
} }
} }

View file

@ -5,7 +5,6 @@ import 'package:stackwallet/pages/add_wallet_views/create_or_restore_wallet_view
import 'package:stackwallet/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_title.dart'; import 'package:stackwallet/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_title.dart';
import 'package:stackwallet/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart'; import 'package:stackwallet/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart';
import 'package:stackwallet/utilities/theme/color_theme.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
@ -82,11 +81,6 @@ class CreateOrRestoreWalletView extends StatelessWidget {
), ),
); );
} else { } else {
final isChans = Theme.of(context).extension<StackColors>()!.themeType ==
ThemeType.chan ||
Theme.of(context).extension<StackColors>()!.themeType ==
ThemeType.darkChans;
return Background( return Background(
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor:
@ -114,10 +108,9 @@ class CreateOrRestoreWalletView extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
if (!isChans) const Spacer(
const Spacer( flex: 2,
flex: 2, ),
),
CoinImage( CoinImage(
coin: entity.coin, coin: entity.coin,
width: isDesktop width: isDesktop

View file

@ -843,7 +843,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
), ),
ExchangeTextField( ExchangeTextField(
key: Key("exchangeTextFieldKeyFor_" key: Key("exchangeTextFieldKeyFor_"
"${Theme.of(context).extension<StackColors>()!.themeType.name}" "${Theme.of(context).extension<StackColors>()!.themeId}"
"${ref.watch(efCurrencyPairProvider.select((value) => value.send?.ticker))}"), "${ref.watch(efCurrencyPairProvider.select((value) => value.send?.ticker))}"),
controller: _sendController, controller: _sendController,
focusNode: _sendFocusNode, focusNode: _sendFocusNode,
@ -925,7 +925,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
), ),
ExchangeTextField( ExchangeTextField(
key: Key( key: Key(
"exchangeTextFieldKeyFor1_${Theme.of(context).extension<StackColors>()!.themeType.name}"), "exchangeTextFieldKeyFor1_${Theme.of(context).extension<StackColors>()!.themeId}"),
focusNode: _receiveFocusNode, focusNode: _receiveFocusNode,
controller: _receiveController, controller: _receiveController,
textStyle: STextStyles.smallMed14(context).copyWith( textStyle: STextStyles.smallMed14(context).copyWith(

View file

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:decimal/decimal.dart'; import 'package:decimal/decimal.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -8,6 +9,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart'; import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart';
import 'package:stackwallet/models/isar/stack_theme.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart'; import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/pages/exchange_view/edit_trade_note_view.dart'; import 'package:stackwallet/pages/exchange_view/edit_trade_note_view.dart';
import 'package:stackwallet/pages/exchange_view/send_from_view.dart'; import 'package:stackwallet/pages/exchange_view/send_from_view.dart';
@ -21,6 +23,7 @@ import 'package:stackwallet/services/exchange/exchange.dart';
import 'package:stackwallet/services/exchange/majestic_bank/majestic_bank_exchange.dart'; import 'package:stackwallet/services/exchange/majestic_bank/majestic_bank_exchange.dart';
import 'package:stackwallet/services/exchange/simpleswap/simpleswap_exchange.dart'; import 'package:stackwallet/services/exchange/simpleswap/simpleswap_exchange.dart';
import 'package:stackwallet/services/exchange/trocador/trocador_exchange.dart'; import 'package:stackwallet/services/exchange/trocador/trocador_exchange.dart';
import 'package:stackwallet/themes/theme_providers.dart';
import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart'; import 'package:stackwallet/utilities/clipboard_interface.dart';
@ -110,7 +113,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
super.initState(); super.initState();
} }
String _fetchIconAssetForStatus(String statusString) { String _fetchIconAssetForStatus(String statusString, ThemeAssets assets) {
ChangeNowTransactionStatus? status; ChangeNowTransactionStatus? status;
try { try {
if (statusString.toLowerCase().startsWith("waiting")) { if (statusString.toLowerCase().startsWith("waiting")) {
@ -121,10 +124,10 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
switch (statusString.toLowerCase()) { switch (statusString.toLowerCase()) {
case "funds confirming": case "funds confirming":
case "processing payment": case "processing payment":
return Assets.svg.txExchangePending(context); return assets.txExchangePending;
case "completed": case "completed":
return Assets.svg.txExchange(context); return assets.txExchange;
default: default:
status = ChangeNowTransactionStatus.Failed; status = ChangeNowTransactionStatus.Failed;
@ -139,11 +142,11 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
case ChangeNowTransactionStatus.Sending: case ChangeNowTransactionStatus.Sending:
case ChangeNowTransactionStatus.Refunded: case ChangeNowTransactionStatus.Refunded:
case ChangeNowTransactionStatus.Verifying: case ChangeNowTransactionStatus.Verifying:
return Assets.svg.txExchangePending(context); return assets.txExchangePending;
case ChangeNowTransactionStatus.Finished: case ChangeNowTransactionStatus.Finished:
return Assets.svg.txExchange(context); return assets.txExchange;
case ChangeNowTransactionStatus.Failed: case ChangeNowTransactionStatus.Failed:
return Assets.svg.txExchangeFailed(context); return assets.txExchangeFailed;
} }
} }
@ -315,8 +318,17 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
if (isDesktop) if (isDesktop)
Row( Row(
children: [ children: [
SvgPicture.asset( SvgPicture.file(
_fetchIconAssetForStatus(trade.status), File(
_fetchIconAssetForStatus(
trade.status,
ref.watch(
themeProvider.select(
(value) => value.assets,
),
),
),
),
width: 32, width: 32,
height: 32, height: 32,
), ),
@ -377,8 +389,17 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
), ),
child: Center( child: Center(
child: SvgPicture.asset( child: SvgPicture.file(
_fetchIconAssetForStatus(trade.status), File(
_fetchIconAssetForStatus(
trade.status,
ref.watch(
themeProvider.select(
(value) => value.assets,
),
),
),
),
width: 32, width: 32,
height: 32, height: 32,
), ),

View file

@ -1,26 +1,27 @@
import 'dart:io';
import 'dart:math'; import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:lottie/lottie.dart'; import 'package:lottie/lottie.dart';
import 'package:stackwallet/themes/theme_providers.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/theme/color_theme.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/conditional_parent.dart'; import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/rounded_container.dart'; import 'package:stackwallet/widgets/rounded_container.dart';
class LoadingView extends StatelessWidget { class LoadingView extends ConsumerWidget {
const LoadingView({Key? key}) : super(key: key); const LoadingView({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context, WidgetRef ref) {
final size = MediaQuery.of(context).size; final size = MediaQuery.of(context).size;
final width = min(size.width, size.height) * 0.5; final width = min(size.width, size.height) * 0.5;
final isChan = Theme.of(context).extension<StackColors>()!.themeType == final assetPath = ref.watch(
ThemeType.chan || themeProvider.select((value) => value.assets.loadingGif),
Theme.of(context).extension<StackColors>()!.themeType == );
ThemeType.darkChans;
return Background( return Background(
child: Scaffold( child: Scaffold(
@ -29,9 +30,8 @@ class LoadingView extends StatelessWidget {
color: Theme.of(context).extension<StackColors>()!.background, color: Theme.of(context).extension<StackColors>()!.background,
child: Center( child: Center(
child: ConditionalParent( child: ConditionalParent(
condition: condition: Theme.of(context).extension<StackColors>()!.themeId ==
Theme.of(context).extension<StackColors>()!.themeType == "oled_black",
ThemeType.oledBlack,
builder: (child) => RoundedContainer( builder: (child) => RoundedContainer(
color: const Color(0xFFDEDEDE), color: const Color(0xFFDEDEDE),
radiusMultiplier: 100, radiusMultiplier: 100,
@ -41,10 +41,10 @@ class LoadingView extends StatelessWidget {
), ),
child: SizedBox( child: SizedBox(
width: width, width: width,
child: isChan child: assetPath != null
? Image( ? Image.file(
image: AssetImage( File(
Assets.gif.stacyPlain, assetPath,
), ),
) )
: Lottie.asset( : Lottie.asset(

View file

@ -1,15 +1,17 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/themes/coin_image_provider.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/color_theme.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/animated_widgets/rotating_arrows.dart'; import 'package:stackwallet/widgets/animated_widgets/rotating_arrows.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart'; import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import 'package:stackwallet/widgets/stack_dialog.dart'; import 'package:stackwallet/widgets/stack_dialog.dart';
class BuildingTransactionDialog extends StatefulWidget { class BuildingTransactionDialog extends ConsumerStatefulWidget {
const BuildingTransactionDialog({ const BuildingTransactionDialog({
Key? key, Key? key,
required this.onCancel, required this.onCancel,
@ -20,10 +22,11 @@ class BuildingTransactionDialog extends StatefulWidget {
final Coin coin; final Coin coin;
@override @override
State<BuildingTransactionDialog> createState() => _RestoringDialogState(); ConsumerState<BuildingTransactionDialog> createState() =>
_RestoringDialogState();
} }
class _RestoringDialogState extends State<BuildingTransactionDialog> { class _RestoringDialogState extends ConsumerState<BuildingTransactionDialog> {
late final VoidCallback onCancel; late final VoidCallback onCancel;
@override @override
@ -35,10 +38,11 @@ class _RestoringDialogState extends State<BuildingTransactionDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isChans = Theme.of(context).extension<StackColors>()!.themeType == final assetPath = ref.watch(
ThemeType.chan || coinImageSecondaryProvider(
Theme.of(context).extension<StackColors>()!.themeType == widget.coin,
ThemeType.darkChans; ),
);
if (Util.isDesktop) { if (Util.isDesktop) {
return Column( return Column(
@ -51,17 +55,14 @@ class _RestoringDialogState extends State<BuildingTransactionDialog> {
const SizedBox( const SizedBox(
height: 40, height: 40,
), ),
if (isChans) assetPath.endsWith(".gif")
Image( ? Image.file(File(
image: AssetImage( assetPath,
Assets.gif.kiss(widget.coin), ))
), : const RotatingArrows(
), width: 40,
if (!isChans) height: 40,
const RotatingArrows( ),
width: 40,
height: 40,
),
const SizedBox( const SizedBox(
height: 40, height: 40,
), ),
@ -79,17 +80,15 @@ class _RestoringDialogState extends State<BuildingTransactionDialog> {
onWillPop: () async { onWillPop: () async {
return false; return false;
}, },
child: isChans child: assetPath.endsWith(".gif")
? StackDialogBase( ? StackDialogBase(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Image( Image.file(File(
image: AssetImage( assetPath,
Assets.gif.kiss(widget.coin), )),
),
),
Text( Text(
"Generating transaction", "Generating transaction",
textAlign: TextAlign.center, textAlign: TextAlign.center,

View file

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
@ -15,6 +16,7 @@ import 'package:stackwallet/providers/global/prefs_provider.dart';
import 'package:stackwallet/providers/global/price_provider.dart'; import 'package:stackwallet/providers/global/price_provider.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart'; import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart'; import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
import 'package:stackwallet/themes/theme_providers.dart';
import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount.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';
@ -163,7 +165,7 @@ class TokenSummary extends ConsumerWidget {
} }
} }
class TokenWalletOptions extends StatelessWidget { class TokenWalletOptions extends ConsumerWidget {
const TokenWalletOptions({ const TokenWalletOptions({
Key? key, Key? key,
required this.walletId, required this.walletId,
@ -199,7 +201,7 @@ class TokenWalletOptions extends StatelessWidget {
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context, WidgetRef ref) {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -214,7 +216,7 @@ class TokenWalletOptions extends StatelessWidget {
); );
}, },
subLabel: "Receive", subLabel: "Receive",
iconAssetSVG: Assets.svg.arrowDownLeft, iconAssetPathSVG: Assets.svg.arrowDownLeft,
), ),
const SizedBox( const SizedBox(
width: 16, width: 16,
@ -231,7 +233,7 @@ class TokenWalletOptions extends StatelessWidget {
); );
}, },
subLabel: "Send", subLabel: "Send",
iconAssetSVG: Assets.svg.arrowUpRight, iconAssetPathSVG: Assets.svg.arrowUpRight,
), ),
const SizedBox( const SizedBox(
width: 16, width: 16,
@ -239,7 +241,11 @@ class TokenWalletOptions extends StatelessWidget {
TokenOptionsButton( TokenOptionsButton(
onPressed: () => _onExchangePressed(context), onPressed: () => _onExchangePressed(context),
subLabel: "Swap", subLabel: "Swap",
iconAssetSVG: Assets.svg.exchange(context), iconAssetPathSVG: ref.watch(
themeProvider.select(
(value) => value.assets.exchange,
),
),
), ),
const SizedBox( const SizedBox(
width: 16, width: 16,
@ -247,7 +253,7 @@ class TokenWalletOptions extends StatelessWidget {
TokenOptionsButton( TokenOptionsButton(
onPressed: () => _onBuyPressed(context), onPressed: () => _onBuyPressed(context),
subLabel: "Buy", subLabel: "Buy",
iconAssetSVG: Assets.svg.creditCard, iconAssetPathSVG: Assets.svg.creditCard,
), ),
], ],
); );
@ -259,12 +265,12 @@ class TokenOptionsButton extends StatelessWidget {
Key? key, Key? key,
required this.onPressed, required this.onPressed,
required this.subLabel, required this.subLabel,
required this.iconAssetSVG, required this.iconAssetPathSVG,
}) : super(key: key); }) : super(key: key);
final VoidCallback onPressed; final VoidCallback onPressed;
final String subLabel; final String subLabel;
final String iconAssetSVG; final String iconAssetPathSVG;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -302,8 +308,8 @@ class TokenOptionsButton extends StatelessWidget {
child: child, child: child,
), ),
), ),
child: SvgPicture.asset( child: SvgPicture.file(
iconAssetSVG, File(iconAssetPathSVG),
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.tokenSummaryIcon, .tokenSummaryIcon,

View file

@ -9,11 +9,13 @@ import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart'; import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart';
import 'package:stackwallet/models/exchange/response_objects/trade.dart'; import 'package:stackwallet/models/exchange/response_objects/trade.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart';
import 'package:stackwallet/models/isar/stack_theme.dart';
import 'package:stackwallet/pages/exchange_view/trade_details_view.dart'; import 'package:stackwallet/pages/exchange_view/trade_details_view.dart';
import 'package:stackwallet/providers/exchange/trade_sent_from_stack_lookup_provider.dart'; import 'package:stackwallet/providers/exchange/trade_sent_from_stack_lookup_provider.dart';
import 'package:stackwallet/providers/global/trades_service_provider.dart'; import 'package:stackwallet/providers/global/trades_service_provider.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart'; import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/route_generator.dart'; import 'package:stackwallet/route_generator.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/utilities/format.dart'; import 'package:stackwallet/utilities/format.dart';
@ -285,7 +287,7 @@ class DesktopTradeRowCard extends ConsumerStatefulWidget {
class _DesktopTradeRowCardState extends ConsumerState<DesktopTradeRowCard> { class _DesktopTradeRowCardState extends ConsumerState<DesktopTradeRowCard> {
late final String tradeId; late final String tradeId;
String _fetchIconAssetForStatus(String statusString, BuildContext context) { String _fetchIconAssetForStatus(String statusString, ThemeAssets assets) {
ChangeNowTransactionStatus? status; ChangeNowTransactionStatus? status;
try { try {
if (statusString.toLowerCase().startsWith("waiting")) { if (statusString.toLowerCase().startsWith("waiting")) {
@ -296,10 +298,10 @@ class _DesktopTradeRowCardState extends ConsumerState<DesktopTradeRowCard> {
switch (statusString.toLowerCase()) { switch (statusString.toLowerCase()) {
case "funds confirming": case "funds confirming":
case "processing payment": case "processing payment":
return Assets.svg.txExchangePending(context); return assets.txExchangePending;
case "completed": case "completed":
return Assets.svg.txExchange(context); return assets.txExchange;
default: default:
status = ChangeNowTransactionStatus.Failed; status = ChangeNowTransactionStatus.Failed;
@ -314,11 +316,11 @@ class _DesktopTradeRowCardState extends ConsumerState<DesktopTradeRowCard> {
case ChangeNowTransactionStatus.Sending: case ChangeNowTransactionStatus.Sending:
case ChangeNowTransactionStatus.Refunded: case ChangeNowTransactionStatus.Refunded:
case ChangeNowTransactionStatus.Verifying: case ChangeNowTransactionStatus.Verifying:
return Assets.svg.txExchangePending(context); return assets.txExchangePending;
case ChangeNowTransactionStatus.Finished: case ChangeNowTransactionStatus.Finished:
return Assets.svg.txExchange(context); return assets.txExchange;
case ChangeNowTransactionStatus.Failed: case ChangeNowTransactionStatus.Failed:
return Assets.svg.txExchangeFailed(context); return assets.txExchangeFailed;
} }
} }
@ -523,7 +525,7 @@ class _DesktopTradeRowCardState extends ConsumerState<DesktopTradeRowCard> {
child: SvgPicture.asset( child: SvgPicture.asset(
_fetchIconAssetForStatus( _fetchIconAssetForStatus(
trade.status, trade.status,
context, ref.watch(themeProvider.select((value) => value.assets)),
), ),
width: 32, width: 32,
height: 32, height: 32,