From 93441bdf4d75abdfe83d3ca723968411a157a732 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Mon, 1 May 2023 14:14:08 -0600 Subject: [PATCH] theme_coin_provider + replaced big coin images --- .../sub_widgets/coin_image.dart | 3 +- .../subviews/coin_select_sheet.dart | 4 +- lib/themes/theme_coin_provider.dart | 40 +++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 lib/themes/theme_coin_provider.dart diff --git a/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/coin_image.dart b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/coin_image.dart index 4b8a18005..f99036c96 100644 --- a/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/coin_image.dart +++ b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/coin_image.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackwallet/themes/theme_coin_provider.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/theme/color_theme.dart'; @@ -41,7 +42,7 @@ class CoinImage extends ConsumerWidget { ); } else { return SvgPicture.asset( - Assets.svg.imageFor(coin: coin, context: context), + ref.watch(coinImageProvider(coin)), width: width, height: height, ); diff --git a/lib/pages/address_book_views/subviews/coin_select_sheet.dart b/lib/pages/address_book_views/subviews/coin_select_sheet.dart index 7be2f8739..6167406e0 100644 --- a/lib/pages/address_book_views/subviews/coin_select_sheet.dart +++ b/lib/pages/address_book_views/subviews/coin_select_sheet.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stackwallet/providers/global/prefs_provider.dart'; -import 'package:stackwallet/utilities/assets.dart'; +import 'package:stackwallet/themes/theme_coin_provider.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/text_styles.dart'; @@ -88,7 +88,7 @@ class CoinSelectSheet extends StatelessWidget { child: Row( children: [ SvgPicture.asset( - Assets.svg.iconFor(coin: coin), + ref.watch(coinImageProvider(coin)), height: 20, width: 20, ), diff --git a/lib/themes/theme_coin_provider.dart b/lib/themes/theme_coin_provider.dart new file mode 100644 index 000000000..854380ed8 --- /dev/null +++ b/lib/themes/theme_coin_provider.dart @@ -0,0 +1,40 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackwallet/themes/theme_providers.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; + +final coinImageProvider = Provider.family((ref, coin) { + final assets = ref.watch(themeProvider).assets; + switch (coin) { + case Coin.bitcoin: + return assets.bitcoinImage; + case Coin.litecoin: + case Coin.litecoinTestNet: + return assets.litecoinImage; + case Coin.bitcoincash: + return assets.bitcoincashImage; + case Coin.dogecoin: + return assets.dogecoinImage; + case Coin.epicCash: + return assets.epicCashImage; + case Coin.firo: + return assets.firoImage; + case Coin.monero: + return assets.moneroImage; + case Coin.wownero: + return assets.wowneroImage; + case Coin.namecoin: + return assets.namecoinImage; + case Coin.particl: + return assets.particlImage; + case Coin.bitcoinTestNet: + return assets.bitcoinImage; + case Coin.bitcoincashTestnet: + return assets.bitcoincashImage; + case Coin.firoTestNet: + return assets.firoImage; + case Coin.dogecoinTestNet: + return assets.dogecoinImage; + case Coin.ethereum: + return assets.ethereumImage; + } +});