@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
44import 'package:flutter_riverpod/flutter_riverpod.dart' ;
55import 'package:tuple/tuple.dart' ;
66
7+ import '../../../../models/exchange/response_objects/trade.dart' ;
78import '../../../../models/isar/models/blockchain_data/v2/transaction_v2.dart' ;
89import '../../../../models/isar/models/isar_models.dart' ;
910import '../../../../providers/global/trades_service_provider.dart' ;
@@ -38,12 +39,17 @@ class TxListItem extends ConsumerWidget {
3839 if (tx is TransactionV2 ) {
3940 final _tx = tx as TransactionV2 ;
4041
41- final matchingTrades = ref
42- .read (tradesServiceProvider)
43- .trades
44- .where ((e) => e.payInTxid == _tx.txid || e.payOutTxid == _tx.txid);
42+ final Iterable <Trade > matchingTrades =
43+ _tx.type == TransactionType .outgoing && _tx.txid.isNotEmpty
44+ ? ref
45+ .read (tradesServiceProvider)
46+ .trades
47+ .where (
48+ (e) => e.payInTxid == _tx.txid || e.payOutTxid == _tx.txid,
49+ )
50+ : [];
4551
46- if (_tx.type == TransactionType .outgoing && matchingTrades.isNotEmpty) {
52+ if (matchingTrades.isNotEmpty) {
4753 final trade = matchingTrades.first;
4854 return Container (
4955 decoration: BoxDecoration (
@@ -54,10 +60,7 @@ class TxListItem extends ConsumerWidget {
5460 child: Column (
5561 mainAxisSize: MainAxisSize .min,
5662 children: [
57- TransactionCardV2 (
58- key: UniqueKey (),
59- transaction: _tx,
60- ),
63+ TransactionCardV2 (key: UniqueKey (), transaction: _tx),
6164 TradeCard (
6265 key: Key (
6366 _tx.txid +
@@ -94,7 +97,8 @@ class TxListItem extends ConsumerWidget {
9497 Text (
9598 "Trade details" ,
9699 style: STextStyles .desktopH3 (
97- context),
100+ context,
101+ ),
98102 ),
99103 DesktopDialogCloseButton (
100104 onPressedOverride: Navigator .of (
@@ -111,8 +115,9 @@ class TxListItem extends ConsumerWidget {
111115 // TODO: [prio:med]
112116 // transactionIfSentFromStack: tx,
113117 transactionIfSentFromStack: null ,
114- walletName: ref
115- .watch (pWalletName (_tx.walletId)),
118+ walletName: ref.watch (
119+ pWalletName (_tx.walletId),
120+ ),
116121 walletId: _tx.walletId,
117122 ),
118123 ),
@@ -171,10 +176,7 @@ class TxListItem extends ConsumerWidget {
171176 borderRadius: radius,
172177 ),
173178 child: Breathing (
174- child: FusionTxGroupCard (
175- key: UniqueKey (),
176- group: group,
177- ),
179+ child: FusionTxGroupCard (key: UniqueKey (), group: group),
178180 ),
179181 );
180182 }
0 commit comments