remove image property from Fiat and Crypto models

and don't check for them in selection views
This commit is contained in:
sneurlax 2023-01-24 13:29:05 -06:00
parent fb257ef39e
commit c0836f9c67
4 changed files with 22 additions and 56 deletions

View file

@ -11,15 +11,11 @@ class Crypto {
/// Crypto contract address
final String? contractAddress;
/// Crypto logo url
final String image;
Crypto({
required this.ticker,
required this.name,
required this.network,
required this.contractAddress,
required this.image,
});
factory Crypto.fromJson(Map<String, dynamic> json) {
@ -29,7 +25,6 @@ class Crypto {
name: "${json['name']}",
network: "${json['network']}",
contractAddress: "${json['contractAddress']}",
image: "${json['image']}",
);
} catch (e) {
rethrow;
@ -42,7 +37,6 @@ class Crypto {
"name": name,
"network": network,
"contractAddress": contractAddress,
"image": image,
};
return map;
@ -51,14 +45,12 @@ class Crypto {
Crypto copyWith({
String? ticker,
String? name,
String? image,
}) {
return Crypto(
ticker: ticker ?? this.ticker,
name: name ?? this.name,
network: network ?? this.network,
contractAddress: contractAddress ?? this.contractAddress,
image: image ?? this.image,
);
}

View file

@ -13,15 +13,11 @@ class Fiat {
/// Fiat name
final Decimal max_amount;
/// Fiat logo url
final String image;
Fiat(
{required this.ticker,
required this.name,
required this.min_amount,
required this.max_amount,
required this.image});
required this.max_amount});
factory Fiat.fromJson(Map<String, dynamic> json) {
try {
@ -30,7 +26,6 @@ class Fiat {
name: "${json['name']}", // TODO nameFromTicker
min_amount: Decimal.parse("${json['min_amount'] ?? 0}"),
max_amount: Decimal.parse("${json['max_amount'] ?? 0}"),
image: "${json['image']}",
);
} catch (e) {
rethrow;
@ -43,7 +38,6 @@ class Fiat {
"name": name,
"min_amount": min_amount,
"max_amount": max_amount,
"image": image,
};
return map;
@ -54,14 +48,12 @@ class Fiat {
String? name,
Decimal? min_amount,
Decimal? max_amount,
String? image,
}) {
return Fiat(
ticker: ticker ?? this.ticker,
name: name ?? this.name,
min_amount: min_amount ?? this.min_amount,
max_amount: max_amount ?? this.max_amount,
image: image ?? this.image,
);
}

View file

@ -11,7 +11,6 @@ import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:stackwallet/widgets/stack_text_field.dart';
import 'package:stackwallet/widgets/textfield_icon_button.dart';
@ -200,15 +199,7 @@ class _CryptoSelectionViewState extends State<CryptoSelectionView> {
SizedBox(
width: 24,
height: 24,
child: _coins[index].image.isNotEmpty
? SvgPicture.network(
_coins[index].image,
width: 24,
height: 24,
placeholderBuilder: (_) =>
const LoadingIndicator(),
)
: getIconForTicker(_coins[index].ticker)),
child: getIconForTicker(_coins[index].ticker)),
const SizedBox(
width: 10,
),

View file

@ -12,7 +12,6 @@ import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:stackwallet/widgets/stack_text_field.dart';
import 'package:stackwallet/widgets/textfield_icon_button.dart';
@ -206,15 +205,7 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
SizedBox(
width: 48,
height: 24,
child: _fiats[index].image.isNotEmpty
? SvgPicture.network(
_fiats[index].image,
width: 24,
height: 24,
placeholderBuilder: (_) =>
const LoadingIndicator(),
)
: Text(
child: Text(
format.simpleCurrencySymbol(
_fiats[index].ticker.toUpperCase()),
style: STextStyles.currencyTicker(context)