Skip to content

Commit

Permalink
feat: add dividers between wallet history items
Browse files Browse the repository at this point in the history
  • Loading branch information
Restioson committed Sep 7, 2023
1 parent 97fd086 commit 0bdd312
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions mobile/lib/features/wallet/wallet_history_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,25 @@ abstract class WalletHistoryItem extends StatelessWidget {

int sats = data.amount.sats * directionMultiplier;

List<Widget> children = [
HistoryDetail(
label: "Amount", value: sats.toString(), displayValue: formatSats(Amount(sats))),
HistoryDetail(
label: "When",
displayValue: timeago.format(data.timestamp),
value: dateFormat.format(data.timestamp)),
...getDetails(),
];

return AlertDialog(
title: Text(title),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
HistoryDetail(
label: "Amount", value: sats.toString(), displayValue: formatSats(Amount(sats))),
HistoryDetail(
label: "When",
displayValue: timeago.format(data.timestamp),
value: dateFormat.format(data.timestamp)),
...getDetails(),
],
),
content: Column(mainAxisSize: MainAxisSize.min, children: [
...children
.take(children.length - 1)
.where((child) => child is! Visibility || child.visible)
.expand((child) => [child, const Divider()]),
children.last,
]),
);
}
}
Expand Down Expand Up @@ -194,11 +199,11 @@ class LightningPaymentHistoryItem extends WalletHistoryItem {
label: "Expiry time",
value: WalletHistoryItem.dateFormat.format(data.expiry ?? DateTime.utc(0))),
),
HistoryDetail(label: "Invoice description", value: data.description),
Visibility(
visible: data.invoice != null,
child: HistoryDetail(label: "Invoice", value: data.invoice ?? ''),
child: HistoryDetail(label: "Lightning invoice", value: data.invoice ?? ''),
),
HistoryDetail(label: "Invoice description", value: data.description),
HistoryDetail(label: "Payment hash", value: data.paymentHash),
Visibility(
visible: data.preimage != null,
Expand Down

0 comments on commit 0bdd312

Please sign in to comment.