Merge branch 'themes' of github.com:cypherstack/stack_wallet into themes

This commit is contained in:
likho 2023-05-02 15:11:14 +02:00
commit bff4f3f97f
4 changed files with 45 additions and 4 deletions

View file

@ -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,
);

View file

@ -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,
),

View file

@ -202,7 +202,7 @@ class _ThemeToggle extends ConsumerState<ThemeToggle> {
case ThemeType.light:
return Assets.svg.themeLight;
case ThemeType.dark:
return Assets.svg.themeDark;
return ref.watch(themeProvider).assets.themePreview;
case ThemeType.darkChans:
return Assets.svg.themeDarkChan;
case ThemeType.oceanBreeze:

View 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;
}
});