Skip to content

Commit

Permalink
[WIP] Improve how refundable items are displayed
Browse files Browse the repository at this point in the history
fixes #332

This is subject to change
  • Loading branch information
erdemyerebasmaz committed Jan 22, 2025
1 parent 4fe73cb commit 65c7d65
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_breez_liquid/flutter_breez_liquid.dart';
import 'package:l_breez/cubit/cubit.dart';
import 'package:l_breez/routes/home/widgets/widgets.dart';

Expand Down Expand Up @@ -39,7 +40,8 @@ class _PaymentDetailsSheetHeaderState extends State<PaymentDetailsSheetHeader> {
),
PaymentDetailsSheetContentTitle(paymentData: widget.paymentData),
PaymentDetailsSheetDescription(paymentData: widget.paymentData),
if (widget.paymentData.isRefunded) ...<Widget>[
if (widget.paymentData.isRefunded ||
widget.paymentData.status == PaymentState.refundable) ...<Widget>[
const Padding(
padding: EdgeInsets.only(top: 8),
child: Chip(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ class PaymentDetailsSheetRefundTxAmount extends StatelessWidget {
builder: (BuildContext context, CurrencyState state) {
final String amountSats = BitcoinCurrency.fromTickerSymbol(
state.bitcoinTicker,
).format(paymentData.refundTxAmountSat);
).format(
paymentData.status == PaymentState.refundable
? paymentData.amountSat + paymentData.feeSat
: paymentData.refundTxAmountSat,
);
return Text(
paymentData.paymentType == PaymentType.receive || paymentData.isRefunded
? texts.payment_details_dialog_amount_positive(amountSats)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class PaymentItemAmount extends StatelessWidget {
: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
(paymentData.isRefunded)
(paymentData.isRefunded || paymentData.status == PaymentState.refundable)
? const SizedBox.shrink()
: Text(
hideBalance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PaymentItemAvatar extends StatelessWidget {
radius: radius,
backgroundColor: Colors.white,
child: Icon(
paymentData.isRefunded
paymentData.isRefunded || paymentData.status == PaymentState.refundable
? Icons.close_rounded
: paymentData.paymentType == PaymentType.receive
? Icons.add_rounded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PaymentItemSubtitle extends StatelessWidget {
),
),
],
if (paymentData.isRefunded) ...<Widget>[
if (paymentData.isRefunded || paymentData.status == PaymentState.refundable) ...<Widget>[
Text(
' (Failed)',
style: subtitleTextStyle.copyWith(
Expand Down

0 comments on commit 65c7d65

Please sign in to comment.