svg address book icons

This commit is contained in:
Serhii 2023-10-05 12:02:05 +03:00
parent 332047c2d1
commit 9788fa9d57
2 changed files with 22 additions and 5 deletions

View file

@ -119,7 +119,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
static const eos = CryptoCurrency(title: 'EOS', fullName: 'EOS', raw: 7, name: 'eos', iconPath: 'assets/images/crypto_assets/eos_icon.svg');
static const eth = CryptoCurrency(title: 'ETH', fullName: 'Ethereum', raw: 8, name: 'eth', iconPath: 'assets/images/crypto_assets/eth_icon.svg');
static const ltc = CryptoCurrency(title: 'LTC', fullName: 'Litecoin', raw: 9, name: 'ltc', iconPath: 'assets/images/crypto_assets/ltc_icon.svg');
static const nano = CryptoCurrency(title: 'NANO', raw: 10, name: 'nano', iconPath: 'assets/images/crypto_assets/nano_icon.svg');
static const nano = CryptoCurrency(title: 'NANO', raw: 10, name: 'nano', iconPath: 'assets/images/crypto_assets/xno_icon.svg');
static const trx = CryptoCurrency(title: 'TRX', fullName: 'TRON', raw: 11, name: 'trx', iconPath: 'assets/images/crypto_assets/trx_icon.svg');
static const usdt = CryptoCurrency(title: 'USDT', tag: 'OMNI', fullName: 'USDT Tether', raw: 12, name: 'usdt', iconPath: 'assets/images/crypto_assets/usdt_icon.svg');
static const usdterc20 = CryptoCurrency(title: 'USDT', tag: 'ETH', fullName: 'USDT Tether', raw: 13, name: 'usdterc20', iconPath: 'assets/images/crypto_assets/usdterc20_icon.svg');

View file

@ -16,6 +16,7 @@ import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/view_model/contact_list/contact_list_view_model.dart';
import 'package:cake_wallet/src/widgets/collapsible_standart_list.dart';
import 'package:flutter_svg/flutter_svg.dart';
class ContactListPage extends BasePage {
ContactListPage(this.contactListViewModel, this.authService);
@ -112,10 +113,7 @@ class ContactListPage extends BasePage {
}
Widget generateRaw(BuildContext context, ContactBase contact) {
final image = contact.type.iconPath;
final currencyIcon = image != null
? Image.asset(image, height: 24, width: 24)
: const SizedBox(height: 24, width: 24);
final currencyIcon = getIcon(contact.type.iconPath);
return GestureDetector(
onTap: () async {
@ -156,6 +154,25 @@ class ContactListPage extends BasePage {
);
}
Widget getIcon(String? image) {
if (image != null && image.contains('svg')) {
return SvgPicture.asset(
image,
height: 24,
width: 24,
fit: BoxFit.contain,
);
} else if (image != null && image.isNotEmpty) {
return Image.asset(
image,
height: 24,
width: 24,
);
} else {
return const SizedBox(height: 24, width: 24);
}
}
Future<bool> showAlertDialog(BuildContext context) async {
return await showPopUp<bool>(
context: context,