fix: use SvgPicture.file constructors for themed assets located in the filesystem

This commit is contained in:
julian 2023-05-09 17:59:26 -06:00
parent f8e6b060e6
commit 71992ea0c8
18 changed files with 215 additions and 112 deletions

View file

@ -1,3 +1,5 @@
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';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
@ -8,8 +10,8 @@ import 'package:stackwallet/models/isar/exchange_cache/currency.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart'; import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart';
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart'; import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.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/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
@ -76,8 +78,10 @@ class CoinSelectItem extends ConsumerWidget {
width: 26, width: 26,
height: 26, height: 26,
) )
: SvgPicture.asset( : SvgPicture.file(
File(
ref.watch(coinIconProvider(entity.coin)), ref.watch(coinIconProvider(entity.coin)),
),
width: 26, width: 26,
height: 26, height: 26,
), ),

View file

@ -1,9 +1,11 @@
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';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/models/buy/response_objects/crypto.dart'; import 'package:stackwallet/models/buy/response_objects/crypto.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.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/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
@ -289,8 +291,10 @@ class CoinIconForTicker extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
try { try {
final coin = coinFromTickerCaseInsensitive(ticker); final coin = coinFromTickerCaseInsensitive(ticker);
return SvgPicture.asset( return SvgPicture.file(
File(
ref.watch(coinIconProvider(coin)), ref.watch(coinIconProvider(coin)),
),
width: size, width: size,
height: size, height: size,
); );

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';
@ -12,8 +13,8 @@ import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/route_generator.dart'; import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/services/coins/firo/firo_wallet.dart'; import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
import 'package:stackwallet/services/coins/manager.dart'; import 'package:stackwallet/services/coins/manager.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.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';
@ -575,10 +576,12 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(6), padding: const EdgeInsets.all(6),
child: SvgPicture.asset( child: SvgPicture.file(
File(
ref.watch( ref.watch(
coinIconProvider(coin), coinIconProvider(coin),
), ),
),
width: 24, width: 24,
height: 24, height: 24,
), ),

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';
@ -163,12 +164,14 @@ class _HomeViewState extends ConsumerState<HomeView> {
GestureDetector( GestureDetector(
onTap: _hiddenOptions, onTap: _hiddenOptions,
child: RotateIcon( child: RotateIcon(
icon: SvgPicture.asset( icon: SvgPicture.file(
File(
ref.watch( ref.watch(
themeProvider.select( themeProvider.select(
(value) => value.assets.stackIcon, (value) => value.assets.stackIcon,
), ),
), ),
),
width: 24, width: 24,
height: 24, height: 24,
), ),
@ -204,19 +207,31 @@ class _HomeViewState extends ConsumerState<HomeView> {
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.backgroundAppBar, .backgroundAppBar,
icon: SvgPicture.asset( icon: ref.watch(notificationsProvider
ref.watch(notificationsProvider
.select((value) => value.hasUnreadNotifications)) .select((value) => value.hasUnreadNotifications))
? ref.watch( ? SvgPicture.file(
File(
ref.watch(
themeProvider.select( themeProvider.select(
(value) => value.assets.bellNew, (value) => value.assets.bellNew,
), ),
) ),
: Assets.svg.bell, ),
width: 20, width: 20,
height: 20, height: 20,
color: ref.watch(notificationsProvider color: ref.watch(notificationsProvider.select(
.select((value) => value.hasUnreadNotifications)) (value) => value.hasUnreadNotifications))
? null
: Theme.of(context)
.extension<StackColors>()!
.topNavIconPrimary,
)
: SvgPicture.asset(
Assets.svg.bell,
width: 20,
height: 20,
color: ref.watch(notificationsProvider.select(
(value) => value.hasUnreadNotifications))
? null ? null
: Theme.of(context) : Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!

View file

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
@ -53,12 +55,14 @@ class _IntroViewState extends ConsumerState<IntroView> {
constraints: const BoxConstraints( constraints: const BoxConstraints(
maxWidth: 300, maxWidth: 300,
), ),
child: SvgPicture.asset( child: SvgPicture.file(
File(
ref.watch( ref.watch(
themeProvider.select( themeProvider.select(
(value) => value.assets.stack, (value) => value.assets.stack,
), ),
), ),
),
width: isDesktop ? 324 : 266, width: isDesktop ? 324 : 266,
height: isDesktop ? 324 : 266, height: isDesktop ? 324 : 266,
), ),
@ -120,7 +124,8 @@ class _IntroViewState extends ConsumerState<IntroView> {
SizedBox( SizedBox(
width: 130, width: 130,
height: 130, height: 130,
child: SvgPicture.asset( child: SvgPicture.file(
File(
ref.watch( ref.watch(
themeProvider.select( themeProvider.select(
(value) => value.assets.stackIcon, (value) => value.assets.stackIcon,
@ -128,6 +133,7 @@ class _IntroViewState extends ConsumerState<IntroView> {
), ),
), ),
), ),
),
const Spacer( const Spacer(
flex: 42, flex: 42,
), ),

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';
@ -86,10 +87,12 @@ class _AddressCardState extends ConsumerState<AddressCard> {
builder: (child) => Row( builder: (child) => Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SvgPicture.asset( SvgPicture.file(
File(
ref.watch( ref.watch(
coinIconProvider(widget.coin), coinIconProvider(widget.coin),
), ),
),
width: 32, width: 32,
height: 32, height: 32,
), ),

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';
@ -514,12 +515,14 @@ class _ConfirmTransactionViewState
), ),
child: Row( child: Row(
children: [ children: [
SvgPicture.asset( SvgPicture.file(
File(
ref.watch( ref.watch(
themeProvider.select( themeProvider.select(
(value) => value.assets.send, (value) => value.assets.send,
), ),
), ),
),
width: 32, width: 32,
height: 32, height: 32,
), ),

View file

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:bip47/bip47.dart'; import 'package:bip47/bip47.dart';
import 'package:cw_core/monero_transaction_priority.dart'; import 'package:cw_core/monero_transaction_priority.dart';
@ -24,8 +25,8 @@ import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/services/coins/firo/firo_wallet.dart'; import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
import 'package:stackwallet/services/coins/manager.dart'; import 'package:stackwallet/services/coins/manager.dart';
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart'; import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/address_utils.dart'; import 'package:stackwallet/utilities/address_utils.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';
@ -758,10 +759,12 @@ class _SendViewState extends ConsumerState<SendView> {
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Row( child: Row(
children: [ children: [
SvgPicture.asset( SvgPicture.file(
File(
ref.watch( ref.watch(
coinIconProvider(coin), coinIconProvider(coin),
), ),
),
width: 22, width: 22,
height: 22, height: 22,
), ),

View file

@ -1,3 +1,5 @@
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';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
@ -54,10 +56,12 @@ class _CoinNodesViewState extends ConsumerState<CoinNodesView> {
const SizedBox( const SizedBox(
width: 32, width: 32,
), ),
SvgPicture.asset( SvgPicture.file(
File(
ref.watch( ref.watch(
coinIconProvider(widget.coin), coinIconProvider(widget.coin),
), ),
),
width: 24, width: 24,
height: 24, height: 24,
), ),

View file

@ -1,10 +1,12 @@
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';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart'; import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.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';
@ -102,10 +104,12 @@ class _ManageNodesViewState extends ConsumerState<ManageNodesView> {
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
child: Row( child: Row(
children: [ children: [
SvgPicture.asset( SvgPicture.file(
File(
ref.watch( ref.watch(
coinIconProvider(coin), coinIconProvider(coin),
), ),
),
width: 24, width: 24,
height: 24, height: 24,
), ),

View file

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
@ -69,12 +71,7 @@ class TxIcon extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final txIsReceived = transaction.type == TransactionType.incoming; final txIsReceived = transaction.type == TransactionType.incoming;
return SizedBox( final assetName = _getAssetName(
width: size.width,
height: size.height,
child: Center(
child: SvgPicture.asset(
_getAssetName(
transaction.isCancelled, transaction.isCancelled,
txIsReceived, txIsReceived,
!transaction.isConfirmed( !transaction.isConfirmed(
@ -82,11 +79,27 @@ class TxIcon extends ConsumerWidget {
coin.requiredConfirmations, coin.requiredConfirmations,
), ),
ref.watch(themeProvider).assets, ref.watch(themeProvider).assets,
);
return SizedBox(
width: size.width,
height: size.height,
child: Center(
// if it starts with "assets" we assume its local
// TODO: a more thorough check
child: assetName.startsWith("assets")
? SvgPicture.asset(
assetName,
width: size.width,
height: size.height,
)
: SvgPicture.file(
File(
assetName,
), ),
width: size.width, width: size.width,
height: size.height, height: size.height,
), )),
),
); );
} }
} }

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';
@ -12,8 +13,8 @@ import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
import 'package:stackwallet/services/event_bus/events/global/balance_refreshed_event.dart'; import 'package:stackwallet/services/event_bus/events/global/balance_refreshed_event.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/services/event_bus/global_event_bus.dart'; import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.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/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
@ -178,8 +179,10 @@ class _WalletSummaryInfoState extends ConsumerState<WalletSummaryInfo> {
), ),
Column( Column(
children: [ children: [
SvgPicture.asset( SvgPicture.file(
File(
ref.watch(coinIconProvider(coin)), ref.watch(coinIconProvider(coin)),
),
width: 24, width: 24,
height: 24, height: 24,
), ),

View file

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:event_bus/event_bus.dart'; import 'package:event_bus/event_bus.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -37,8 +38,8 @@ import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_
import 'package:stackwallet/services/event_bus/global_event_bus.dart'; import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart'; import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart'; import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/theme_providers.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';
@ -471,8 +472,10 @@ class _WalletViewState extends ConsumerState<WalletView> {
titleSpacing: 0, titleSpacing: 0,
title: Row( title: Row(
children: [ children: [
SvgPicture.asset( SvgPicture.file(
File(
ref.watch(coinIconProvider(coin)), ref.watch(coinIconProvider(coin)),
),
width: 24, width: 24,
height: 24, height: 24,
), ),
@ -538,20 +541,36 @@ class _WalletViewState extends ConsumerState<WalletView> {
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.background, .background,
icon: SvgPicture.asset( icon: ref.watch(notificationsProvider.select(
ref.watch(notificationsProvider.select((value) => (value) => value
value.hasUnreadNotificationsFor(walletId))) .hasUnreadNotificationsFor(walletId)))
? ref.watch( ? SvgPicture.file(
File(
ref.watch(
themeProvider.select( themeProvider.select(
(value) => value.assets.bellNew, (value) => value.assets.bellNew,
), ),
) ),
: Assets.svg.bell, ),
width: 20, width: 20,
height: 20, height: 20,
color: ref.watch(notificationsProvider.select( color: ref.watch(notificationsProvider.select(
(value) => value (value) =>
.hasUnreadNotificationsFor(walletId))) value.hasUnreadNotificationsFor(
walletId)))
? null
: Theme.of(context)
.extension<StackColors>()!
.topNavIconPrimary,
)
: SvgPicture.asset(
Assets.svg.bell,
width: 20,
height: 20,
color: ref.watch(notificationsProvider.select(
(value) =>
value.hasUnreadNotificationsFor(
walletId)))
? null ? null
: Theme.of(context) : Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!

View file

@ -1,3 +1,5 @@
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';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
@ -31,12 +33,14 @@ class EmptyWallets extends ConsumerWidget {
const Spacer( const Spacer(
flex: 2, flex: 2,
), ),
SvgPicture.asset( SvgPicture.file(
File(
ref.watch( ref.watch(
themeProvider.select( themeProvider.select(
(value) => value.assets.stack, (value) => value.assets.stack,
), ),
), ),
),
width: isDesktop ? 324 : MediaQuery.of(context).size.width / 3, width: isDesktop ? 324 : MediaQuery.of(context).size.width / 3,
), ),
SizedBox( SizedBox(

View file

@ -1,3 +1,5 @@
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';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@ -5,8 +7,8 @@ import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/desktop_wallet_view.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/desktop_wallet_view.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/coins/manager.dart'; import 'package:stackwallet/services/coins/manager.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.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';
@ -213,8 +215,10 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
overflow: TextOverflow.fade, overflow: TextOverflow.fade,
), ),
), ),
SvgPicture.asset( SvgPicture.file(
File(
ref.watch(coinIconProvider(coin)), ref.watch(coinIconProvider(coin)),
),
width: 24, width: 24,
height: 24, height: 24,
), ),

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';
@ -6,8 +7,8 @@ import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages/wallet_view/wallet_view.dart'; import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
import 'package:stackwallet/pages/wallets_view/wallets_overview.dart'; import 'package:stackwallet/pages/wallets_view/wallets_overview.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
@ -79,8 +80,10 @@ class WalletListItem extends ConsumerWidget {
}, },
child: Row( child: Row(
children: [ children: [
SvgPicture.asset( SvgPicture.file(
File(
ref.watch(coinIconProvider(coin)), ref.watch(coinIconProvider(coin)),
),
width: 28, width: 28,
height: 28, height: 28,
), ),

View file

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:event_bus/event_bus.dart'; import 'package:event_bus/event_bus.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -19,8 +20,8 @@ import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/providers/ui/transaction_filter_provider.dart'; import 'package:stackwallet/providers/ui/transaction_filter_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/services/event_bus/global_event_bus.dart'; import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart';
import 'package:stackwallet/themes/stack_colors.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/enums/backup_frequency_type.dart'; import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
@ -265,8 +266,10 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
const SizedBox( const SizedBox(
width: 15, width: 15,
), ),
SvgPicture.asset( SvgPicture.file(
File(
ref.watch(coinIconProvider(coin)), ref.watch(coinIconProvider(coin)),
),
width: 32, width: 32,
height: 32, height: 32,
), ),
@ -321,8 +324,10 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: Row( child: Row(
children: [ children: [
SvgPicture.asset( SvgPicture.file(
File(
ref.watch(coinIconProvider(coin)), ref.watch(coinIconProvider(coin)),
),
width: 40, width: 40,
height: 40, height: 40,
), ),

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';
@ -347,8 +348,10 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
label: "Buy", label: "Buy",
width: buttonWidth, width: buttonWidth,
buttonHeight: ButtonHeight.l, buttonHeight: ButtonHeight.l,
icon: SvgPicture.asset( icon: SvgPicture.file(
File(
ref.watch(themeProvider.select((value) => value.assets.buy)), ref.watch(themeProvider.select((value) => value.assets.buy)),
),
height: 20, height: 20,
width: 20, width: 20,
color: Theme.of(context) color: Theme.of(context)