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/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/ui/color_theme_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';
class CoinImage extends ConsumerWidget { class CoinImage extends ConsumerWidget {
const CoinImage({ const CoinImage({
@ -18,34 +16,9 @@ class CoinImage extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final bool isSorbet = ref.read(colorThemeProvider.state).state.themeType == return SvgPicture.asset(
ThemeType.fruitSorbet; Assets.svg.imageFor(coin: coin, context: context),
final bool isForest = width: isDesktop ? 324 : MediaQuery.of(context).size.width,
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,
);
} }
} }

View file

@ -2,6 +2,7 @@ import 'dart:async';
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:stackwallet/notifications/show_flush_bar.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/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'; 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, flex: 1,
), ),
if (!isDesktop) if (!isDesktop)
Image( SvgPicture.asset(
image: AssetImage( Assets.svg.imageFor(coin: coin, context: context),
Assets.png.imageFor(coin: coin, context: context),
),
height: 100, height: 100,
), ),
SizedBox( SizedBox(

View file

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

View file

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