2023-05-26 21:21:16 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Stack Wallet.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2023 Cypher Stack
|
|
|
|
* All Rights Reserved.
|
|
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-05-01 20:14:08 +00:00
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
2023-05-18 18:52:48 +00:00
|
|
|
import 'package:stackwallet/models/isar/stack_theme.dart';
|
2023-05-01 20:14:08 +00:00
|
|
|
import 'package:stackwallet/themes/theme_providers.dart';
|
|
|
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|
|
|
|
|
|
|
final coinImageProvider = Provider.family<String, Coin>((ref, coin) {
|
2023-05-18 18:52:48 +00:00
|
|
|
final assets = ref.watch(themeAssetsProvider);
|
|
|
|
|
|
|
|
if (assets is ThemeAssets) {
|
|
|
|
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.eCash:
|
|
|
|
return assets.bitcoinImage;
|
|
|
|
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;
|
2023-05-24 18:08:32 +00:00
|
|
|
default:
|
2023-06-08 16:35:44 +00:00
|
|
|
return assets.stackIcon;
|
2023-05-18 18:52:48 +00:00
|
|
|
}
|
2023-06-08 16:35:44 +00:00
|
|
|
} else if (assets is ThemeAssetsV2) {
|
|
|
|
return (assets).coinImages[coin.mainNetVersion]!;
|
2023-05-18 18:52:48 +00:00
|
|
|
} else {
|
2023-06-08 16:35:44 +00:00
|
|
|
return (assets as ThemeAssetsV3).coinImages[coin.mainNetVersion]!;
|
2023-05-01 20:14:08 +00:00
|
|
|
}
|
|
|
|
});
|
2023-05-09 16:36:01 +00:00
|
|
|
|
|
|
|
final coinImageSecondaryProvider = Provider.family<String, Coin>((ref, coin) {
|
2023-05-18 18:52:48 +00:00
|
|
|
final assets = ref.watch(themeAssetsProvider);
|
|
|
|
|
|
|
|
if (assets is ThemeAssets) {
|
|
|
|
switch (coin) {
|
|
|
|
case Coin.bitcoin:
|
|
|
|
return assets.bitcoinImageSecondary;
|
|
|
|
case Coin.litecoin:
|
|
|
|
case Coin.litecoinTestNet:
|
|
|
|
return assets.litecoinImageSecondary;
|
|
|
|
case Coin.bitcoincash:
|
|
|
|
return assets.bitcoincashImageSecondary;
|
|
|
|
case Coin.dogecoin:
|
|
|
|
return assets.dogecoinImageSecondary;
|
|
|
|
case Coin.eCash:
|
|
|
|
return assets.bitcoinImageSecondary;
|
|
|
|
case Coin.epicCash:
|
|
|
|
return assets.epicCashImageSecondary;
|
|
|
|
case Coin.firo:
|
|
|
|
return assets.firoImageSecondary;
|
|
|
|
case Coin.monero:
|
|
|
|
return assets.moneroImageSecondary;
|
|
|
|
case Coin.wownero:
|
|
|
|
return assets.wowneroImageSecondary;
|
|
|
|
case Coin.namecoin:
|
|
|
|
return assets.namecoinImageSecondary;
|
|
|
|
case Coin.particl:
|
|
|
|
return assets.particlImageSecondary;
|
|
|
|
case Coin.bitcoinTestNet:
|
|
|
|
return assets.bitcoinImageSecondary;
|
|
|
|
case Coin.bitcoincashTestnet:
|
|
|
|
return assets.bitcoincashImageSecondary;
|
|
|
|
case Coin.firoTestNet:
|
|
|
|
return assets.firoImageSecondary;
|
|
|
|
case Coin.dogecoinTestNet:
|
|
|
|
return assets.dogecoinImageSecondary;
|
|
|
|
case Coin.ethereum:
|
|
|
|
return assets.ethereumImageSecondary;
|
2023-05-24 18:08:32 +00:00
|
|
|
|
|
|
|
default:
|
2023-06-08 16:35:44 +00:00
|
|
|
return assets.stackIcon;
|
2023-05-18 18:52:48 +00:00
|
|
|
}
|
2023-06-08 16:35:44 +00:00
|
|
|
} else if (assets is ThemeAssetsV2) {
|
|
|
|
return (assets).coinSecondaryImages[coin.mainNetVersion]!;
|
2023-05-18 18:52:48 +00:00
|
|
|
} else {
|
2023-06-08 16:35:44 +00:00
|
|
|
return (assets as ThemeAssetsV3).coinSecondaryImages[coin.mainNetVersion]!;
|
2023-05-09 16:36:01 +00:00
|
|
|
}
|
|
|
|
});
|