mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 20:09:23 +00:00
clean up transaction list item ui state update key
This commit is contained in:
parent
92076bf12a
commit
69934fb871
1 changed files with 17 additions and 16 deletions
|
@ -20,6 +20,8 @@ import 'package:stackwallet/widgets/trade_card.dart';
|
||||||
import 'package:stackwallet/widgets/transaction_card.dart';
|
import 'package:stackwallet/widgets/transaction_card.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
|
import '../../../utilities/enums/coin_enum.dart';
|
||||||
|
|
||||||
class TransactionsList extends ConsumerStatefulWidget {
|
class TransactionsList extends ConsumerStatefulWidget {
|
||||||
const TransactionsList({
|
const TransactionsList({
|
||||||
Key? key,
|
Key? key,
|
||||||
|
@ -67,11 +69,18 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
Transaction tx,
|
Transaction tx,
|
||||||
BorderRadius? radius,
|
BorderRadius? radius,
|
||||||
|
Coin coin,
|
||||||
) {
|
) {
|
||||||
final matchingTrades = ref
|
final matchingTrades = ref
|
||||||
.read(tradesServiceProvider)
|
.read(tradesServiceProvider)
|
||||||
.trades
|
.trades
|
||||||
.where((e) => e.payInTxid == tx.txid || e.payOutTxid == tx.txid);
|
.where((e) => e.payInTxid == tx.txid || e.payOutTxid == tx.txid);
|
||||||
|
|
||||||
|
final isConfirmed = tx.isConfirmed(
|
||||||
|
ref.watch(
|
||||||
|
widget.managerProvider.select((value) => value.currentHeight)),
|
||||||
|
coin.requiredConfirmations);
|
||||||
|
|
||||||
if (tx.type == TransactionType.outgoing && matchingTrades.isNotEmpty) {
|
if (tx.type == TransactionType.outgoing && matchingTrades.isNotEmpty) {
|
||||||
final trade = matchingTrades.first;
|
final trade = matchingTrades.first;
|
||||||
return Container(
|
return Container(
|
||||||
|
@ -84,13 +93,9 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
|
||||||
children: [
|
children: [
|
||||||
TransactionCard(
|
TransactionCard(
|
||||||
// this may mess with combined firo transactions
|
// this may mess with combined firo transactions
|
||||||
key: Key(tx.txid +
|
key: isConfirmed
|
||||||
tx.type.name +
|
? Key(tx.txid + tx.type.name + tx.address.value.toString())
|
||||||
tx.address.value.toString() +
|
: UniqueKey(), //
|
||||||
ref
|
|
||||||
.watch(widget.managerProvider
|
|
||||||
.select((value) => value.currentHeight))
|
|
||||||
.toString()), //
|
|
||||||
transaction: tx,
|
transaction: tx,
|
||||||
walletId: widget.walletId,
|
walletId: widget.walletId,
|
||||||
),
|
),
|
||||||
|
@ -185,13 +190,9 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
|
||||||
),
|
),
|
||||||
child: TransactionCard(
|
child: TransactionCard(
|
||||||
// this may mess with combined firo transactions
|
// this may mess with combined firo transactions
|
||||||
key: Key(tx.txid +
|
key: isConfirmed
|
||||||
tx.type.name +
|
? Key(tx.txid + tx.type.name + tx.address.value.toString())
|
||||||
tx.address.value.toString() +
|
: UniqueKey(),
|
||||||
ref
|
|
||||||
.watch(widget.managerProvider
|
|
||||||
.select((value) => value.currentHeight))
|
|
||||||
.toString()), //
|
|
||||||
transaction: tx,
|
transaction: tx,
|
||||||
walletId: widget.walletId,
|
walletId: widget.walletId,
|
||||||
),
|
),
|
||||||
|
@ -263,7 +264,7 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
|
||||||
radius = _borderRadiusFirst;
|
radius = _borderRadiusFirst;
|
||||||
}
|
}
|
||||||
final tx = _transactions2[index];
|
final tx = _transactions2[index];
|
||||||
return itemBuilder(context, tx, radius);
|
return itemBuilder(context, tx, radius, manager.coin);
|
||||||
},
|
},
|
||||||
separatorBuilder: (context, index) {
|
separatorBuilder: (context, index) {
|
||||||
return Container(
|
return Container(
|
||||||
|
@ -290,7 +291,7 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
|
||||||
radius = _borderRadiusFirst;
|
radius = _borderRadiusFirst;
|
||||||
}
|
}
|
||||||
final tx = _transactions2[index];
|
final tx = _transactions2[index];
|
||||||
return itemBuilder(context, tx, radius);
|
return itemBuilder(context, tx, radius, manager.coin);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue