mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 20:09:23 +00:00
show trades in tx history
This commit is contained in:
parent
98bf943160
commit
4fcebda78c
1 changed files with 66 additions and 12 deletions
|
@ -9,7 +9,12 @@ import 'package:stackwallet/services/coins/manager.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/widgets/loading_indicator.dart';
|
import 'package:stackwallet/widgets/loading_indicator.dart';
|
||||||
|
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 '../../../providers/global/trades_service_provider.dart';
|
||||||
|
import '../../exchange_view/trade_details_view.dart';
|
||||||
|
|
||||||
class TransactionsList extends ConsumerStatefulWidget {
|
class TransactionsList extends ConsumerStatefulWidget {
|
||||||
const TransactionsList({
|
const TransactionsList({
|
||||||
|
@ -125,9 +130,57 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
|
||||||
radius = _borderRadiusFirst;
|
radius = _borderRadiusFirst;
|
||||||
}
|
}
|
||||||
final tx = list[index];
|
final tx = list[index];
|
||||||
|
|
||||||
|
final matchingTrades = ref
|
||||||
|
.read(tradesServiceProvider)
|
||||||
|
.trades
|
||||||
|
.where((e) =>
|
||||||
|
e.statusObject != null &&
|
||||||
|
(e.statusObject!.payinHash == tx.txid ||
|
||||||
|
e.statusObject!.payoutHash == tx.txid));
|
||||||
|
if (matchingTrades.isNotEmpty) {
|
||||||
|
final trade = matchingTrades.first;
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
color:
|
||||||
|
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
|
borderRadius: radius,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
TransactionCard(
|
||||||
|
// this may mess with combined firo transactions
|
||||||
|
key: Key(tx.toString()), //
|
||||||
|
transaction: tx,
|
||||||
|
walletId: widget.walletId,
|
||||||
|
),
|
||||||
|
TradeCard(
|
||||||
|
// this may mess with combined firo transactions
|
||||||
|
key: Key(tx.toString() + trade.uuid), //
|
||||||
|
trade: trade,
|
||||||
|
onTap: () {
|
||||||
|
unawaited(
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
TradeDetailsView.routeName,
|
||||||
|
arguments: Tuple4(
|
||||||
|
trade.id,
|
||||||
|
tx,
|
||||||
|
widget.walletId,
|
||||||
|
ref.read(managerProvider).walletName,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
borderRadius: radius,
|
borderRadius: radius,
|
||||||
),
|
),
|
||||||
child: TransactionCard(
|
child: TransactionCard(
|
||||||
|
@ -137,6 +190,7 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
|
||||||
walletId: widget.walletId,
|
walletId: widget.walletId,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue