mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
coin select item token icon
This commit is contained in:
parent
55bac49481
commit
e3bd3d3bf3
1 changed files with 32 additions and 5 deletions
|
@ -1,8 +1,13 @@
|
||||||
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:isar/isar.dart';
|
||||||
import 'package:stackwallet/models/add_wallet_list_entity/add_wallet_list_entity.dart';
|
import 'package:stackwallet/models/add_wallet_list_entity/add_wallet_list_entity.dart';
|
||||||
|
import 'package:stackwallet/models/add_wallet_list_entity/sub_classes/eth_token_entity.dart';
|
||||||
|
import 'package:stackwallet/models/isar/exchange_cache/currency.dart';
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
|
import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart';
|
||||||
|
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
@ -24,6 +29,22 @@ class CoinSelectItem extends ConsumerWidget {
|
||||||
|
|
||||||
final isDesktop = Util.isDesktop;
|
final isDesktop = Util.isDesktop;
|
||||||
|
|
||||||
|
String? tokenImageUri;
|
||||||
|
if (entity is EthTokenEntity) {
|
||||||
|
final currency = ExchangeDataLoadingService.instance.isar.currencies
|
||||||
|
.where()
|
||||||
|
.exchangeNameEqualTo(ChangeNowExchange.exchangeName)
|
||||||
|
.filter()
|
||||||
|
.tokenContractEqualTo(
|
||||||
|
(entity as EthTokenEntity).token.address,
|
||||||
|
caseSensitive: false,
|
||||||
|
)
|
||||||
|
.and()
|
||||||
|
.imageIsNotEmpty()
|
||||||
|
.findFirstSync();
|
||||||
|
tokenImageUri = currency?.image;
|
||||||
|
}
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: selectedEntity == entity
|
color: selectedEntity == entity
|
||||||
|
@ -48,11 +69,17 @@ class CoinSelectItem extends ConsumerWidget {
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SvgPicture.asset(
|
tokenImageUri != null
|
||||||
Assets.svg.iconFor(coin: entity.coin),
|
? SvgPicture.network(
|
||||||
width: 26,
|
tokenImageUri,
|
||||||
height: 26,
|
width: 26,
|
||||||
),
|
height: 26,
|
||||||
|
)
|
||||||
|
: SvgPicture.asset(
|
||||||
|
Assets.svg.iconFor(coin: entity.coin),
|
||||||
|
width: 26,
|
||||||
|
height: 26,
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: isDesktop ? 12 : 10,
|
width: isDesktop ? 12 : 10,
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue