fixes
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
import 'package:pshared/models/asset.dart';
|
||||
import 'package:pshared/models/money.dart';
|
||||
import 'package:pshared/utils/currency.dart';
|
||||
import 'package:pshared/utils/money.dart';
|
||||
|
||||
import 'package:pweb/controllers/payouts/multiple_payouts.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
String moneyLabel(Money? money) {
|
||||
if (money == null) return 'N/A';
|
||||
final amount = parseMoneyAmount(money.amount, fallback: double.nan);
|
||||
if (amount.isNaN) return '${money.amount} ${money.currency}';
|
||||
try {
|
||||
return assetToString(
|
||||
Asset(currency: currencyStringToCode(money.currency), amount: amount),
|
||||
);
|
||||
} catch (_) {
|
||||
return '${money.amount} ${money.currency}';
|
||||
}
|
||||
}
|
||||
|
||||
String sentAmountLabel(MultiplePayoutsController controller) {
|
||||
final requested = controller.requestedSentAmount;
|
||||
final sourceDebit = controller.aggregateDebitAmount;
|
||||
|
||||
if (requested == null && sourceDebit == null) return 'N/A';
|
||||
if (sourceDebit != null) return moneyLabel(sourceDebit);
|
||||
return moneyLabel(requested);
|
||||
}
|
||||
|
||||
String feeLabel(MultiplePayoutsController controller, AppLocalizations l10n) {
|
||||
final fee = controller.aggregateFeeAmount;
|
||||
if (fee == null) return l10n.noFee;
|
||||
return moneyLabel(fee);
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/utils/currency.dart';
|
||||
|
||||
import 'package:pweb/controllers/payouts/multiple_payouts.dart';
|
||||
import 'package:pweb/models/dashboard/summary_values.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/multiple/panels/source_quote/helpers.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/summary/widget.dart';
|
||||
import 'package:pweb/utils/money_display.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class SourceQuoteSummary extends StatelessWidget {
|
||||
const SourceQuoteSummary({
|
||||
super.key,
|
||||
@@ -18,12 +22,27 @@ class SourceQuoteSummary extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
return PaymentSummary(
|
||||
spacing: spacing,
|
||||
values: PaymentSummaryValues(
|
||||
fee: feeLabel(controller, AppLocalizations.of(context)!),
|
||||
recipientReceives: moneyLabel(controller.aggregateSettlementAmount),
|
||||
total: moneyLabel(controller.aggregateDebitAmount),
|
||||
fee: controller.aggregateFeeAmount == null
|
||||
? l10n.noFee
|
||||
: formatMoneyUiWithL10n(
|
||||
l10n,
|
||||
controller.aggregateFeeAmount,
|
||||
separator: nonBreakingSpace,
|
||||
),
|
||||
recipientReceives: formatMoneyUiWithL10n(
|
||||
l10n,
|
||||
controller.aggregateSettlementAmount,
|
||||
separator: nonBreakingSpace,
|
||||
),
|
||||
total: formatMoneyUiWithL10n(
|
||||
l10n,
|
||||
controller.aggregateDebitAmount,
|
||||
separator: nonBreakingSpace,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user