mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
theme_coin_provider + replaced big coin images
This commit is contained in:
parent
ee09a8c724
commit
93441bdf4d
3 changed files with 44 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
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/themes/theme_coin_provider.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';
|
||||||
import 'package:stackwallet/utilities/theme/color_theme.dart';
|
import 'package:stackwallet/utilities/theme/color_theme.dart';
|
||||||
|
@ -41,7 +42,7 @@ class CoinImage extends ConsumerWidget {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return SvgPicture.asset(
|
return SvgPicture.asset(
|
||||||
Assets.svg.imageFor(coin: coin, context: context),
|
ref.watch(coinImageProvider(coin)),
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,7 +2,7 @@ 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/providers/global/prefs_provider.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/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';
|
||||||
|
@ -88,7 +88,7 @@ class CoinSelectSheet extends StatelessWidget {
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SvgPicture.asset(
|
SvgPicture.asset(
|
||||||
Assets.svg.iconFor(coin: coin),
|
ref.watch(coinImageProvider(coin)),
|
||||||
height: 20,
|
height: 20,
|
||||||
width: 20,
|
width: 20,
|
||||||
),
|
),
|
||||||
|
|
40
lib/themes/theme_coin_provider.dart
Normal file
40
lib/themes/theme_coin_provider.dart
Normal file
|
@ -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<String, Coin>((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;
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in a new issue