Skip to content

Commit bf5bfc3

Browse files
committed
fix: use trocador provider icons
1 parent 60d47f2 commit bf5bfc3

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

lib/models/exchange/response_objects/estimate.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Estimate {
1919
final String? warningMessage;
2020
final String? rateId;
2121
final String exchangeProvider;
22+
final String? exchangeProviderLogo;
2223
final String? kycRating;
2324

2425
Estimate({
@@ -28,6 +29,7 @@ class Estimate {
2829
this.warningMessage,
2930
this.rateId,
3031
required this.exchangeProvider,
32+
this.exchangeProviderLogo,
3133
this.kycRating,
3234
});
3335

lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,43 @@ class _ProviderOptionState extends ConsumerState<_ProviderOption> {
314314
child: SizedBox(
315315
width: isDesktop ? 32 : 24,
316316
height: isDesktop ? 32 : 24,
317-
child: SvgPicture.asset(
317+
child: widget.estimate?.exchangeProviderLogo != null &&
318+
widget
319+
.estimate!
320+
.exchangeProviderLogo!
321+
.isNotEmpty
322+
? ClipRRect(
323+
borderRadius: BorderRadius.circular(5),
324+
child: Image.network(
325+
widget.estimate!.exchangeProviderLogo!,
326+
loadingBuilder: (
327+
context,
328+
child,
329+
loadingProgress,
330+
) {
331+
if (loadingProgress == null) {
332+
return child;
333+
} else {
334+
return const Center(
335+
child:
336+
CircularProgressIndicator(),
337+
);
338+
}
339+
},
340+
errorBuilder: (context, error, stackTrace) {
341+
return SvgPicture.asset(
342+
Assets.exchange.getIconFor(
343+
exchangeName: widget.exchange.name,
344+
),
345+
width: isDesktop ? 32 : 24,
346+
height: isDesktop ? 32 : 24,
347+
);
348+
},
349+
width: isDesktop ? 32 : 24,
350+
height: isDesktop ? 32 : 24,
351+
),
352+
)
353+
: SvgPicture.asset(
318354
Assets.exchange.getIconFor(
319355
exchangeName: widget.exchange.name,
320356
),

lib/services/exchange/trocador/response_objects/trocador_quote.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'package:decimal/decimal.dart';
1212

1313
class TrocadorQuote {
1414
final String provider;
15+
final String? providerLogo;
1516
final String kycRating;
1617
final int insurance;
1718
final bool fixed;
@@ -21,6 +22,7 @@ class TrocadorQuote {
2122

2223
TrocadorQuote({
2324
required this.provider,
25+
this.providerLogo,
2426
required this.kycRating,
2527
required this.insurance,
2628
required this.fixed,
@@ -32,6 +34,7 @@ class TrocadorQuote {
3234
factory TrocadorQuote.fromMap(Map<String, dynamic> map) {
3335
return TrocadorQuote(
3436
provider: map['provider'] as String,
37+
providerLogo: map['provider_logo'] as String?,
3538
kycRating: map['kycrating'] as String,
3639
insurance: map['insurance'] as int,
3740
// wtf trocador?

lib/services/exchange/trocador/trocador_exchange.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ class TrocadorExchange extends Exchange {
236236
fixedRate: quote.fixed,
237237
reversed: reversed,
238238
exchangeProvider: quote.provider,
239+
exchangeProviderLogo: quote.providerLogo,
239240
rateId: response.value!.tradeId,
240241
kycRating: quote.kycRating,
241242
),
@@ -256,6 +257,7 @@ class TrocadorExchange extends Exchange {
256257
fixedRate: quote.fixed,
257258
reversed: reversed,
258259
exchangeProvider: quote.provider,
260+
exchangeProviderLogo: quote.providerLogo,
259261
rateId: response.value!.tradeId,
260262
kycRating: quote.kycRating,
261263
),

0 commit comments

Comments
 (0)