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

View file

@ -13,15 +13,11 @@ class Fiat {
/// Fiat name /// Fiat name
final Decimal max_amount; final Decimal max_amount;
/// Fiat logo url
final String image;
Fiat( Fiat(
{required this.ticker, {required this.ticker,
required this.name, required this.name,
required this.min_amount, required this.min_amount,
required this.max_amount, required this.max_amount});
required this.image});
factory Fiat.fromJson(Map<String, dynamic> json) { factory Fiat.fromJson(Map<String, dynamic> json) {
try { try {
@ -30,7 +26,6 @@ class Fiat {
name: "${json['name']}", // TODO nameFromTicker name: "${json['name']}", // TODO nameFromTicker
min_amount: Decimal.parse("${json['min_amount'] ?? 0}"), min_amount: Decimal.parse("${json['min_amount'] ?? 0}"),
max_amount: Decimal.parse("${json['max_amount'] ?? 0}"), max_amount: Decimal.parse("${json['max_amount'] ?? 0}"),
image: "${json['image']}",
); );
} catch (e) { } catch (e) {
rethrow; rethrow;
@ -43,7 +38,6 @@ class Fiat {
"name": name, "name": name,
"min_amount": min_amount, "min_amount": min_amount,
"max_amount": max_amount, "max_amount": max_amount,
"image": image,
}; };
return map; return map;
@ -54,14 +48,12 @@ class Fiat {
String? name, String? name,
Decimal? min_amount, Decimal? min_amount,
Decimal? max_amount, Decimal? max_amount,
String? image,
}) { }) {
return Fiat( return Fiat(
ticker: ticker ?? this.ticker, ticker: ticker ?? this.ticker,
name: name ?? this.name, name: name ?? this.name,
min_amount: min_amount ?? this.min_amount, min_amount: min_amount ?? this.min_amount,
max_amount: max_amount ?? this.max_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/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.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/icon_widgets/x_icon.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:stackwallet/widgets/stack_text_field.dart'; import 'package:stackwallet/widgets/stack_text_field.dart';
import 'package:stackwallet/widgets/textfield_icon_button.dart'; import 'package:stackwallet/widgets/textfield_icon_button.dart';
@ -200,15 +199,7 @@ class _CryptoSelectionViewState extends State<CryptoSelectionView> {
SizedBox( SizedBox(
width: 24, width: 24,
height: 24, height: 24,
child: _coins[index].image.isNotEmpty child: getIconForTicker(_coins[index].ticker)),
? SvgPicture.network(
_coins[index].image,
width: 24,
height: 24,
placeholderBuilder: (_) =>
const LoadingIndicator(),
)
: getIconForTicker(_coins[index].ticker)),
const SizedBox( const SizedBox(
width: 10, 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/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.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/icon_widgets/x_icon.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:stackwallet/widgets/stack_text_field.dart'; import 'package:stackwallet/widgets/stack_text_field.dart';
import 'package:stackwallet/widgets/textfield_icon_button.dart'; import 'package:stackwallet/widgets/textfield_icon_button.dart';
@ -206,15 +205,7 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
SizedBox( SizedBox(
width: 48, width: 48,
height: 24, height: 24,
child: _fiats[index].image.isNotEmpty child: Text(
? SvgPicture.network(
_fiats[index].image,
width: 24,
height: 24,
placeholderBuilder: (_) =>
const LoadingIndicator(),
)
: Text(
format.simpleCurrencySymbol( format.simpleCurrencySymbol(
_fiats[index].ticker.toUpperCase()), _fiats[index].ticker.toUpperCase()),
style: STextStyles.currencyTicker(context) style: STextStyles.currencyTicker(context)