stack_wallet/lib/utilities/assets.dart

435 lines
16 KiB
Dart
Raw Normal View History

2022-09-23 14:33:44 +00:00
import 'package:flutter/material.dart';
2023-03-17 16:47:38 +00:00
import 'package:flutter_svg/flutter_svg.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/theme/color_theme.dart';
2022-09-23 14:33:44 +00:00
import 'package:stackwallet/utilities/theme/stack_colors.dart';
2023-03-17 22:15:05 +00:00
import 'package:stackwallet/utilities/util.dart';
2022-08-26 08:11:35 +00:00
abstract class Assets {
static const svg = _SVG();
static const png = _PNG();
static const lottie = _ANIMATIONS();
static const socials = _SOCIALS();
2022-10-03 18:24:37 +00:00
static const exchange = _EXCHANGE();
2023-01-04 16:49:13 +00:00
static const buy = _BUY();
static const gif = _GIF();
2023-03-17 16:47:38 +00:00
static Future<void> precache(BuildContext context) async {
final assets = [
2023-03-17 22:15:05 +00:00
svg.iconFor(coin: Coin.dogecoin),
2023-03-17 16:47:38 +00:00
svg.stack(context),
svg.personaEasy(context),
svg.personaIncognito(context),
...Coin.values.map(
(e) => svg.imageFor(context: context, coin: e),
),
];
2023-03-17 22:15:05 +00:00
if (Util.isDesktop) {
assets.add(svg.themeChan);
2023-03-20 15:46:23 +00:00
assets.add(svg.themeDarkChan);
2023-03-17 22:15:05 +00:00
}
2023-03-17 16:47:38 +00:00
final futures = assets.map(
(e) => precachePicture(
ExactAssetPicture(
SvgPicture.svgStringDecoderBuilder,
e,
),
context),
);
await Future.wait(futures);
}
2022-08-26 08:11:35 +00:00
}
class _SOCIALS {
const _SOCIALS();
2023-03-13 15:33:20 +00:00
static const _path = "assets/svg/socials/";
String get discord => "${_path}discord.svg";
String get reddit => "${_path}reddit-alien-brands.svg";
String get twitter => "${_path}twitter-brands.svg";
String get telegram => "${_path}telegram-brands.svg";
2022-08-26 08:11:35 +00:00
}
2022-10-03 18:24:37 +00:00
class _EXCHANGE {
const _EXCHANGE();
2023-03-13 15:33:20 +00:00
static const _path = "assets/svg/exchange_icons/";
String get changeNow => "${_path}change_now_logo_1.svg";
String get simpleSwap => "${_path}simpleswap-icon.svg";
String get majesticBankBlue => "${_path}mb_blue.svg";
String get majesticBankGreen => "${_path}mb_green.svg";
2022-10-03 18:24:37 +00:00
}
2023-01-04 16:49:13 +00:00
class _BUY {
const _BUY();
String simplexLogo(BuildContext context) {
2023-03-13 15:33:20 +00:00
switch (Theme.of(context).extension<StackColors>()!.themeType) {
case ThemeType.dark:
case ThemeType.oledBlack:
2023-03-20 15:46:23 +00:00
case ThemeType.darkChans:
2023-03-13 15:33:20 +00:00
return "assets/svg/buy/Simplex-Nuvei-Logo-light.svg";
case ThemeType.fruitSorbet:
case ThemeType.forest:
case ThemeType.oceanBreeze:
case ThemeType.light:
2023-03-17 14:57:40 +00:00
case ThemeType.chan:
2023-04-01 03:43:21 +00:00
case ThemeType.orange:
2023-03-13 15:33:20 +00:00
return "assets/svg/buy/Simplex-Nuvei-Logo.svg";
}
}
2022-10-03 18:24:37 +00:00
}
2023-03-06 15:55:10 +00:00
class _COIN_CONTROL {
const _COIN_CONTROL();
2023-03-13 15:33:20 +00:00
static const _path = "assets/svg/coin_control/";
String get blocked => "${_path}frozen.svg";
String get unBlocked => "${_path}unfrozen.svg";
String get gamePad => "${_path}gamepad.svg";
String get selected => "${_path}selected.svg";
2023-03-06 15:55:10 +00:00
}
2022-08-26 08:11:35 +00:00
class _SVG {
const _SVG();
2023-03-06 15:55:10 +00:00
2023-03-17 14:57:40 +00:00
static String _path(BuildContext context) {
switch (Theme.of(context).extension<StackColors>()!.themeType) {
// chan theme uses all the same assets as the light theme
case ThemeType.chan:
return "assets/svg/themed/${ThemeType.light.name}";
2023-03-20 15:46:23 +00:00
case ThemeType.darkChans:
return "assets/svg/themed/${ThemeType.dark.name}";
2023-03-17 14:57:40 +00:00
default:
return "assets/svg/themed/${Theme.of(context).extension<StackColors>()!.themeType.name}";
}
}
2023-03-13 15:33:20 +00:00
final coinControl = const _COIN_CONTROL();
2023-03-06 15:55:10 +00:00
String? background(BuildContext context) {
switch (Theme.of(context).extension<StackColors>()!.themeType) {
case ThemeType.light:
2023-03-17 14:57:40 +00:00
case ThemeType.chan:
case ThemeType.dark:
2023-04-01 03:43:21 +00:00
case ThemeType.orange:
2023-01-06 16:12:01 +00:00
case ThemeType.oledBlack:
2023-03-20 15:46:23 +00:00
case ThemeType.darkChans:
return null;
case ThemeType.oceanBreeze:
2023-01-23 22:36:13 +00:00
case ThemeType.fruitSorbet:
2023-02-10 21:10:00 +00:00
case ThemeType.forest:
2023-03-17 14:57:40 +00:00
return "${_path(context)}/bg.svg";
}
}
2022-08-26 08:11:35 +00:00
2023-03-17 14:57:40 +00:00
String bellNew(BuildContext context) => "${_path(context)}/bell-new.svg";
String stackIcon(BuildContext context) => "${_path(context)}/stack-icon1.svg";
String exchange(BuildContext context) => "${_path(context)}/exchange-2.svg";
String buy(BuildContext context) => "${_path(context)}/buy-coins-icon.svg";
2022-09-23 14:33:44 +00:00
String receive(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/tx-icon-receive.svg";
2022-09-23 14:33:44 +00:00
String receivePending(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/tx-icon-receive-pending.svg";
2022-09-23 14:33:44 +00:00
String receiveCancelled(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/tx-icon-receive-failed.svg";
2022-09-23 14:33:44 +00:00
2023-03-17 14:57:40 +00:00
String send(BuildContext context) => "${_path(context)}/tx-icon-send.svg";
2022-09-23 14:33:44 +00:00
String sendPending(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/tx-icon-send-pending.svg";
2022-09-23 14:33:44 +00:00
String sendCancelled(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/tx-icon-send-failed.svg";
2022-09-23 14:33:44 +00:00
String txExchange(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/tx-exchange-icon.svg";
2022-09-23 14:33:44 +00:00
String txExchangePending(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/tx-exchange-icon-pending.svg";
2022-09-23 14:33:44 +00:00
String txExchangeFailed(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/tx-exchange-icon-failed.svg";
2022-09-23 14:33:44 +00:00
String personaIncognito(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/persona-incognito-1.svg";
String personaEasy(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/persona-easy-1.svg";
2023-03-17 14:57:40 +00:00
String stack(BuildContext context) => "${_path(context)}/stack.svg";
String get themeFruit => "assets/svg/fruit-sorbet-theme.svg";
2023-02-09 21:37:25 +00:00
String get themeForest => "assets/svg/forest-theme.svg";
String get themeOledBlack => "assets/svg/oled-black-theme.svg";
String get themeOcean => "assets/svg/ocean-breeze-theme.svg";
2023-04-01 03:43:21 +00:00
String get orange => "assets/svg/orange-theme.svg";
2022-11-18 18:26:27 +00:00
String get themeLight => "assets/svg/light-mode.svg";
String get themeDark => "assets/svg/dark-theme.svg";
2023-03-17 17:44:30 +00:00
String get themeChan => "assets/svg/chanstheme.svg";
2023-03-20 15:46:23 +00:00
String get themeDarkChan => "assets/svg/darkChansTheme.svg";
2022-11-18 18:26:27 +00:00
2022-11-15 21:12:55 +00:00
String get circleSliders => "assets/svg/configuration.svg";
2022-11-11 22:58:47 +00:00
String get circlePlus => "assets/svg/plus-circle.svg";
2022-12-21 16:17:53 +00:00
String get circlePlusFilled => "assets/svg/circle-plus-filled.svg";
String get framedGear => "assets/svg/framed-gear.svg";
String get framedAddressBook => "assets/svg/framed-address-book.svg";
2022-10-20 17:54:24 +00:00
String get circleNode => "assets/svg/node-circle.svg";
2022-10-19 22:10:34 +00:00
String get circleSun => "assets/svg/sun-circle.svg";
String get circleArrowRotate => "assets/svg/rotate-circle.svg";
String get circleLanguage => "assets/svg/language-circle.svg";
String get circleDollarSign => "assets/svg/dollar-sign-circle.svg";
String get circleLock => "assets/svg/lock-circle.svg";
String get enableButton => "assets/svg/enabled-button.svg";
2022-10-19 22:10:34 +00:00
String get disableButton => "assets/svg/Button.svg";
2022-10-03 17:58:19 +00:00
String get polygon => "assets/svg/Polygon.svg";
String get drd => "assets/svg/drd-icon.svg";
String get boxAuto => "assets/svg/box-auto.svg";
2022-08-26 08:11:35 +00:00
String get plus => "assets/svg/plus.svg";
String get gear => "assets/svg/gear.svg";
String get bell => "assets/svg/bell.svg";
String get arrowLeft => "assets/svg/arrow-left-fa.svg";
String get star => "assets/svg/star.svg";
String get copy => "assets/svg/copy-fa.svg";
String get circleX => "assets/svg/x-circle.svg";
String get check => "assets/svg/check.svg";
String get circleAlert => "assets/svg/alert-circle2.svg";
String get arrowDownLeft => "assets/svg/arrow-down-left.svg";
String get arrowUpRight => "assets/svg/arrow-up-right.svg";
String get bars => "assets/svg/bars.svg";
String get filter => "assets/svg/filter.svg";
String get pending => "assets/svg/pending.svg";
String get radio => "assets/svg/signal-stream.svg";
String get arrowRotate => "assets/svg/arrow-rotate.svg";
2023-04-24 18:18:50 +00:00
String get arrowsTwoWay => "assets/svg/arrow-rotate2.svg";
2022-08-26 08:11:35 +00:00
String get alertCircle => "assets/svg/alert-circle.svg";
String get checkCircle => "assets/svg/circle-check.svg";
String get clipboard => "assets/svg/clipboard.svg";
String get qrcode => "assets/svg/qrcode1.svg";
String get ellipsis => "assets/svg/gear-3.svg";
String get chevronDown => "assets/svg/chevron-down.svg";
String get chevronUp => "assets/svg/chevron-up.svg";
2022-08-26 08:11:35 +00:00
String get swap => "assets/svg/swap.svg";
String get downloadFolder => "assets/svg/folder-down.svg";
String get lock => "assets/svg/lock-keyhole.svg";
2022-11-18 22:06:03 +00:00
String get lockOpen => "assets/svg/lock-open.svg";
2022-08-26 08:11:35 +00:00
String get network => "assets/svg/network-wired.svg";
String get networkWired => "assets/svg/network-wired-2.svg";
2022-08-26 08:11:35 +00:00
String get addressBook => "assets/svg/address-book.svg";
2022-09-19 19:34:27 +00:00
String get addressBook2 => "assets/svg/address-book2.svg";
2022-08-26 08:11:35 +00:00
String get delete => "assets/svg/delete.svg";
String get arrowRight => "assets/svg/arrow-right.svg";
String get dollarSign => "assets/svg/dollar-sign.svg";
String get language => "assets/svg/language2.svg";
String get sun => "assets/svg/sun-bright2.svg";
String get pencil => "assets/svg/pen-solid-fa.svg";
String get search => "assets/svg/magnifying-glass.svg";
String get thickX => "assets/svg/x-fat.svg";
String get x => "assets/svg/x.svg";
String get user => "assets/svg/user.svg";
2023-01-06 22:31:04 +00:00
String get userPlus => "assets/svg/user-plus.svg";
String get userMinus => "assets/svg/user-minus.svg";
2022-08-26 08:11:35 +00:00
String get trash => "assets/svg/trash.svg";
String get eye => "assets/svg/eye.svg";
String get eyeSlash => "assets/svg/eye-slash.svg";
String get folder => "assets/svg/folder.svg";
String get calendar => "assets/svg/calendar-days.svg";
String get circleQuestion => "assets/svg/circle-question.svg";
String get circleInfo => "assets/svg/info-circle.svg";
String get key => "assets/svg/key.svg";
String get node => "assets/svg/node-alt.svg";
String get radioProblem => "assets/svg/signal-problem-alt.svg";
String get radioSyncing => "assets/svg/signal-sync-alt.svg";
String get walletSettings => "assets/svg/wallet-settings.svg";
String get verticalEllipsis => "assets/svg/ellipsis-vertical1.svg";
String get dice => "assets/svg/dice-alt.svg";
String get circleArrowUpRight => "assets/svg/circle-arrow-up-right2.svg";
String get loader => "assets/svg/loader.svg";
String get backupAdd => "assets/svg/add-backup.svg";
String get backupAuto => "assets/svg/auto-backup.svg";
String get backupRestore => "assets/svg/restore-backup.svg";
String get solidSliders => "assets/svg/sliders-solid.svg";
String get questionMessage => "assets/svg/message-question.svg";
String get envelope => "assets/svg/envelope.svg";
String get share => "assets/svg/share-2.svg";
String get anonymize => "assets/svg/tx-icon-anonymize.svg";
String get anonymizePending => "assets/svg/tx-icon-anonymize-pending.svg";
String get anonymizeFailed => "assets/svg/tx-icon-anonymize-failed.svg";
String get addressBookDesktop => "assets/svg/address-book-desktop.svg";
String get exchangeDesktop => "assets/svg/exchange-desktop.svg";
String get aboutDesktop => "assets/svg/about-desktop.svg";
String get walletDesktop => "assets/svg/wallet-desktop.svg";
String get exitDesktop => "assets/svg/exit-desktop.svg";
2022-10-28 19:51:25 +00:00
String get keys => "assets/svg/keys.svg";
2022-10-31 18:03:21 +00:00
String get arrowDown => "assets/svg/arrow-down.svg";
2023-01-31 15:17:25 +00:00
String get robotHead => "assets/svg/robot-head.svg";
String get whirlPool => "assets/svg/whirlpool.svg";
String get fingerprint => "assets/svg/fingerprint.svg";
String get faceId => "assets/svg/faceid.svg";
2023-01-16 13:19:32 +00:00
String get tokens => "assets/svg/tokens.svg";
String get circlePlusDark => "assets/svg/circle-plus.svg";
2023-02-27 16:37:41 +00:00
String get creditCard => "assets/svg/cc.svg";
2022-08-26 08:11:35 +00:00
String get ellipse1 => "assets/svg/Ellipse-43.svg";
String get ellipse2 => "assets/svg/Ellipse-42.svg";
2023-03-13 15:33:20 +00:00
String get chevronRight => "assets/svg/chevron-right.svg";
String get minimize => "assets/svg/minimize.svg";
String get walletFa => "assets/svg/wallet-fa.svg";
String get exchange3 => "assets/svg/exchange-3.svg";
String get messageQuestion => "assets/svg/message-question-1.svg";
2023-03-15 18:01:10 +00:00
String get list => "assets/svg/list-ul.svg";
2023-03-17 15:01:52 +00:00
String get unclaimedPaynym => "assets/svg/unclaimed.png";
2023-03-13 15:33:20 +00:00
// TODO provide proper assets
String get bitcoinTestnet => "assets/svg/coin_icons/Bitcoin.svg";
String get bitcoincashTestnet => "assets/svg/coin_icons/Bitcoincash.svg";
String get firoTestnet => "assets/svg/coin_icons/Firo.svg";
String get dogecoinTestnet => "assets/svg/coin_icons/Dogecoin.svg";
String get particlTestnet => "assets/svg/coin_icons/Particl.svg";
2022-08-26 08:11:35 +00:00
2023-02-14 21:29:41 +00:00
// small icons
2022-08-26 08:11:35 +00:00
String get bitcoin => "assets/svg/coin_icons/Bitcoin.svg";
2022-10-28 18:03:52 +00:00
String get litecoin => "assets/svg/coin_icons/Litecoin.svg";
2022-09-09 10:59:40 +00:00
String get bitcoincash => "assets/svg/coin_icons/Bitcoincash.svg";
2022-08-26 08:11:35 +00:00
String get dogecoin => "assets/svg/coin_icons/Dogecoin.svg";
String get epicCash => "assets/svg/coin_icons/EpicCash.svg";
2022-12-13 17:39:19 +00:00
String get ethereum => "assets/svg/coin_icons/Ethereum.svg";
2022-08-26 08:11:35 +00:00
String get firo => "assets/svg/coin_icons/Firo.svg";
String get monero => "assets/svg/coin_icons/Monero.svg";
2022-09-27 08:09:31 +00:00
String get wownero => "assets/svg/coin_icons/Wownero.svg";
2022-09-12 12:01:42 +00:00
String get namecoin => "assets/svg/coin_icons/Namecoin.svg";
2022-12-07 17:32:20 +00:00
String get particl => "assets/svg/coin_icons/Particl.svg";
2022-08-26 08:11:35 +00:00
2023-02-28 20:26:13 +00:00
String get bnbIcon => "assets/svg/coin_icons/bnb_icon.svg";
2022-08-26 08:11:35 +00:00
String iconFor({required Coin coin}) {
switch (coin) {
case Coin.bitcoin:
return bitcoin;
2022-10-28 18:03:52 +00:00
case Coin.litecoin:
case Coin.litecoinTestNet:
return litecoin;
2022-09-09 10:59:40 +00:00
case Coin.bitcoincash:
return bitcoincash;
2022-08-26 08:11:35 +00:00
case Coin.dogecoin:
return dogecoin;
case Coin.epicCash:
return epicCash;
2022-12-13 17:39:19 +00:00
case Coin.ethereum:
return ethereum;
2022-08-26 08:11:35 +00:00
case Coin.firo:
return firo;
case Coin.monero:
return monero;
2022-09-27 08:09:31 +00:00
case Coin.wownero:
return wownero;
2022-09-12 12:01:42 +00:00
case Coin.namecoin:
return namecoin;
2022-10-25 15:06:37 +00:00
case Coin.particl:
return particl;
2022-08-26 08:11:35 +00:00
case Coin.bitcoinTestNet:
return bitcoinTestnet;
case Coin.bitcoincashTestnet:
return bitcoincashTestnet;
2022-08-26 08:11:35 +00:00
case Coin.firoTestNet:
return firoTestnet;
case Coin.dogecoinTestNet:
return dogecoinTestnet;
}
}
2023-02-14 21:29:41 +00:00
// big icons
2023-03-17 14:57:40 +00:00
String bitcoinImage(BuildContext context) => "${_path(context)}/bitcoin.svg";
2023-02-21 22:13:56 +00:00
String bitcoincashImage(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/bitcoincash.svg";
String dogecoinImage(BuildContext context) => "${_path(context)}/doge.svg";
String epicCashImage(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/epic-cash.svg";
2023-02-28 15:33:56 +00:00
String ethereumImage(BuildContext context) =>
"${_path(context)}/ethereum.svg";
2023-03-17 14:57:40 +00:00
String firoImage(BuildContext context) => "${_path(context)}/firo.svg";
2023-02-21 22:13:56 +00:00
String litecoinImage(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/litecoin.svg";
String moneroImage(BuildContext context) => "${_path(context)}/monero.svg";
String wowneroImage(BuildContext context) => "${_path(context)}/wownero.svg";
String namecoinImage(BuildContext context) =>
2023-03-17 14:57:40 +00:00
"${_path(context)}/namecoin.svg";
String particlImage(BuildContext context) => "${_path(context)}/particl.svg";
2023-02-14 21:29:41 +00:00
2023-02-21 22:13:56 +00:00
String imageFor({required BuildContext context, required Coin coin}) {
2023-02-14 21:29:41 +00:00
switch (coin) {
case Coin.bitcoin:
2023-02-21 22:13:56 +00:00
return bitcoinImage(context);
2023-02-14 21:29:41 +00:00
case Coin.litecoin:
case Coin.litecoinTestNet:
2023-02-21 22:13:56 +00:00
return litecoinImage(context);
2023-02-14 21:29:41 +00:00
case Coin.bitcoincash:
2023-02-21 22:13:56 +00:00
return bitcoincashImage(context);
2023-02-14 21:29:41 +00:00
case Coin.dogecoin:
2023-02-21 22:13:56 +00:00
return dogecoinImage(context);
2023-02-14 21:29:41 +00:00
case Coin.epicCash:
return epicCashImage(context);
2023-02-14 21:29:41 +00:00
case Coin.firo:
2023-02-21 22:13:56 +00:00
return firoImage(context);
2023-02-14 21:29:41 +00:00
case Coin.monero:
return moneroImage(context);
2023-02-14 21:29:41 +00:00
case Coin.wownero:
2023-02-21 22:13:56 +00:00
return wowneroImage(context);
2023-02-14 21:29:41 +00:00
case Coin.namecoin:
return namecoinImage(context);
2023-02-14 21:29:41 +00:00
case Coin.particl:
2023-02-21 22:13:56 +00:00
return particlImage(context);
2023-02-14 21:29:41 +00:00
case Coin.bitcoinTestNet:
2023-02-21 22:13:56 +00:00
return bitcoinImage(context);
2023-02-14 21:29:41 +00:00
case Coin.bitcoincashTestnet:
2023-02-21 22:13:56 +00:00
return bitcoincashImage(context);
2023-02-14 21:29:41 +00:00
case Coin.firoTestNet:
2023-02-21 22:13:56 +00:00
return firoImage(context);
2023-02-14 21:29:41 +00:00
case Coin.dogecoinTestNet:
2023-02-21 22:13:56 +00:00
return dogecoinImage(context);
2023-02-23 20:36:23 +00:00
case Coin.ethereum:
2023-02-28 15:33:56 +00:00
return ethereumImage(context);
2023-02-14 21:29:41 +00:00
}
}
2022-08-26 08:11:35 +00:00
}
class _PNG {
const _PNG();
String get splash => "assets/images/splash.png";
String get glasses => "assets/images/glasses.png";
String get glassesHidden => "assets/images/glasses-hidden.png";
2023-04-17 15:56:51 +00:00
String get chanEasy => "assets/images/chan-persona-easy.png";
String get chanIncognito => "assets/images/chan-persona-incognito.png";
2022-08-26 08:11:35 +00:00
}
class _ANIMATIONS {
const _ANIMATIONS();
String get test2 => "assets/lottie/test2.json";
2023-04-20 23:39:16 +00:00
String get iconSend => "assets/lottie/icon_send.json";
String get loaderAndCheckmark => "assets/lottie/loader_and_checkmark.json";
2023-04-21 18:18:59 +00:00
String get arrowRotate => "assets/lottie/arrow_rotate.json";
2022-08-26 08:11:35 +00:00
}
class _GIF {
const _GIF();
String get stacyPlain => "assets/gif/stacy-plain.gif";
String plain(Coin coin) {
return "assets/gif/coins/${coin.mainNetVersion.name}/plain.gif";
}
String kiss(Coin coin) {
return "assets/gif/coins/${coin.mainNetVersion.name}/kiss.gif";
}
2022-08-26 08:11:35 +00:00
}