use coin image if buying crypto amount

and remove print in prod
TODO refactor duplicated isStackCoin and getIconForTicker into coin_enum?
This commit is contained in:
sneurlax 2023-01-20 20:05:32 -06:00
parent 8a0c846a1b
commit 1bf55318cc
2 changed files with 13 additions and 15 deletions

View file

@ -350,6 +350,15 @@ class _BuyFormState extends ConsumerState<BuyForm> {
}
}
Widget? getIconForTicker(String ticker) {
String? iconAsset = isStackCoin(ticker)
? Assets.svg.iconFor(coin: coinFromTickerCaseInsensitive(ticker))
: Assets.svg.buyIconFor(ticker);
return (iconAsset != null)
? SvgPicture.asset(iconAsset, height: 20, width: 20)
: null;
}
Future<void> previewQuote(SimplexQuote quote) async {
// if (ref.read(simplexProvider).quote.id == "someID") {
// // TODO make a better way of detecting a default SimplexQuote
@ -587,13 +596,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
padding: const EdgeInsets.all(12),
child: Row(
children: <Widget>[
SvgPicture.asset(
Assets.svg.iconFor(
coin: coinFromTickerCaseInsensitive("BTC"),
),
height: 18,
width: 18,
),
getIconForTicker(selectedCrypto?.ticker ?? "BTC")
as Widget,
const SizedBox(
width: 10,
),
@ -800,13 +804,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
.length)),
textAlign: TextAlign.center,
)
: SvgPicture.asset(
Assets.svg.iconFor(
coin: coinFromTickerCaseInsensitive("BTC"),
),
height: 18,
width: 18,
),
: getIconForTicker(selectedCrypto?.ticker ?? "BTC")
as Widget,
const SizedBox(width: 10), // maybe make isDesktop-aware?
Text(
buyWithFiat

View file

@ -262,7 +262,6 @@ bool isStackCoin(String? ticker) {
}
Widget? getIconForTicker(String ticker) {
print(ticker);
String? iconAsset = isStackCoin(ticker)
? Assets.svg.iconFor(coin: coinFromTickerCaseInsensitive(ticker))
: Assets.svg.buyIconFor(ticker);