replace png pictures with svg pictures

This commit is contained in:
ryleedavis 2023-03-06 09:08:40 -07:00
parent f264e202b2
commit 5c9fe44cbd
4 changed files with 59 additions and 89 deletions

View file

@ -1,10 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/theme/color_theme.dart';
class CoinImage extends ConsumerWidget {
const CoinImage({
@ -18,34 +16,9 @@ class CoinImage extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final bool isSorbet = ref.read(colorThemeProvider.state).state.themeType ==
ThemeType.fruitSorbet;
final bool isForest =
ref.read(colorThemeProvider.state).state.themeType == ThemeType.forest;
final bool isOcean = ref.read(colorThemeProvider.state).state.themeType ==
ThemeType.oceanBreeze;
final bool isOled = ref.read(colorThemeProvider.state).state.themeType ==
ThemeType.oledBlack;
final bool isLight =
ref.read(colorThemeProvider.state).state.themeType == ThemeType.light;
final bool isDark =
ref.read(colorThemeProvider.state).state.themeType == ThemeType.dark;
return ((isSorbet &&
coin != Coin.epicCash &&
coin != Coin.monero &&
coin != Coin.namecoin) ||
(isForest && coin != Coin.dogecoin) ||
((isOcean || isOled || isLight || isDark) && (coin != Coin.monero)))
? SvgPicture.asset(
Assets.svg.imageFor(coin: coin, context: context),
width: isDesktop ? 324 : MediaQuery.of(context).size.width,
)
: Image(
image: AssetImage(
Assets.png.imageFor(coin: coin, context: context),
),
width: isDesktop ? 324 : MediaQuery.of(context).size.width / 3,
);
return SvgPicture.asset(
Assets.svg.imageFor(coin: coin, context: context),
width: isDesktop ? 324 : MediaQuery.of(context).size.width,
);
}
}

View file

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart';
import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart';
@ -165,10 +166,8 @@ class _NameYourWalletViewState extends ConsumerState<NameYourWalletView> {
flex: 1,
),
if (!isDesktop)
Image(
image: AssetImage(
Assets.png.imageFor(coin: coin, context: context),
),
SvgPicture.asset(
Assets.svg.imageFor(coin: coin, context: context),
height: 100,
),
SizedBox(

View file

@ -282,10 +282,8 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
flex: isDesktop ? 10 : 1,
),
if (!isDesktop)
Image(
image: AssetImage(
Assets.png.imageFor(coin: coin, context: context),
),
SvgPicture.asset(
Assets.svg.imageFor(coin: coin, context: context),
height: 100,
),
SizedBox(

View file

@ -337,26 +337,26 @@ class _PNG {
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/stack.png";
String get splash => "assets/images/splash.png";
String monero(BuildContext context) =>
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/monero.png";
String wownero(BuildContext context) =>
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/wownero.png";
String firo(BuildContext context) =>
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/firo.png";
String dogecoin(BuildContext context) =>
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/doge.png";
String bitcoin(BuildContext context) =>
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/bitcoin.png";
String litecoin(BuildContext context) =>
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/litecoin.png";
String epicCash(BuildContext context) =>
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/epic-cash.png";
String bitcoincash(BuildContext context) =>
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/bitcoincash.png";
String namecoin(BuildContext context) =>
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/namecoin.png";
String particl(BuildContext context) =>
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/particl.png";
// String monero(BuildContext context) =>
// "assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/monero.png";
// String wownero(BuildContext context) =>
// "assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/wownero.png";
// String firo(BuildContext context) =>
// "assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/firo.png";
// String dogecoin(BuildContext context) =>
// "assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/doge.png";
// String bitcoin(BuildContext context) =>
// "assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/bitcoin.png";
// String litecoin(BuildContext context) =>
// "assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/litecoin.png";
// String epicCash(BuildContext context) =>
// "assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/epic-cash.png";
// String bitcoincash(BuildContext context) =>
// "assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/bitcoincash.png";
// String namecoin(BuildContext context) =>
// "assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/namecoin.png";
// String particl(BuildContext context) =>
// "assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/particl.png";
String personaIncognito(BuildContext context) =>
"assets/svg/${Theme.of(context).extension<StackColors>()!.themeType.name}/persona-incognito-1.png";
@ -366,36 +366,36 @@ class _PNG {
String get glasses => "assets/images/glasses.png";
String get glassesHidden => "assets/images/glasses-hidden.png";
String imageFor({required BuildContext context, required Coin coin}) {
switch (coin) {
case Coin.bitcoin:
case Coin.bitcoinTestNet:
return bitcoin(context);
case Coin.litecoin:
case Coin.litecoinTestNet:
return litecoin(context);
case Coin.bitcoincash:
case Coin.bitcoincashTestnet:
return bitcoincash(context);
case Coin.dogecoin:
case Coin.dogecoinTestNet:
return dogecoin(context);
case Coin.epicCash:
return epicCash(context);
case Coin.firo:
return firo(context);
case Coin.firoTestNet:
return firo(context);
case Coin.monero:
return monero(context);
case Coin.wownero:
return wownero(context);
case Coin.namecoin:
return namecoin(context);
case Coin.particl:
return particl(context);
}
}
// String imageFor({required BuildContext context, required Coin coin}) {
// switch (coin) {
// case Coin.bitcoin:
// case Coin.bitcoinTestNet:
// return bitcoin(context);
// case Coin.litecoin:
// case Coin.litecoinTestNet:
// return litecoin(context);
// case Coin.bitcoincash:
// case Coin.bitcoincashTestnet:
// return bitcoincash(context);
// case Coin.dogecoin:
// case Coin.dogecoinTestNet:
// return dogecoin(context);
// case Coin.epicCash:
// return epicCash(context);
// case Coin.firo:
// return firo(context);
// case Coin.firoTestNet:
// return firo(context);
// case Coin.monero:
// return monero(context);
// case Coin.wownero:
// return wownero(context);
// case Coin.namecoin:
// return namecoin(context);
// case Coin.particl:
// return particl(context);
// }
// }
}
class _ANIMATIONS {