quotation rate display

This commit is contained in:
Stephan D
2025-12-12 13:45:58 +01:00
parent d64d7dab58
commit 00045c1e65
35 changed files with 530 additions and 199 deletions

View File

@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:pshared/provider/payment/quotation.dart';
import 'package:pweb/pages/dashboard/payouts/summary/row.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
class PaymentFeeRow extends StatelessWidget {
const PaymentFeeRow({super.key});
@override
Widget build(BuildContext context) => Consumer<QuotationProvider>(
builder: (context, provider, _) => PaymentSummaryRow(
labelFactory: AppLocalizations.of(context)!.fee,
asset: provider.fee,
style: Theme.of(context).textTheme.titleMedium,
),
);
}

View File

@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:pshared/provider/payment/quotation.dart';
import 'package:pweb/pages/dashboard/payouts/summary/row.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
class PaymentRecipientReceivesRow extends StatelessWidget {
const PaymentRecipientReceivesRow({super.key});
@override
Widget build(BuildContext context) => Consumer<QuotationProvider>(
builder: (context, provider, _) => PaymentSummaryRow(
labelFactory: AppLocalizations.of(context)!.recipientWillReceive,
asset: provider.recipientGets,
style: Theme.of(context).textTheme.titleMedium,
),
);
}

View File

@@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import 'package:pshared/models/asset.dart';
import 'package:pshared/utils/currency.dart';
class PaymentSummaryRow extends StatelessWidget {
final String Function(String) labelFactory;
final Asset? asset;
final TextStyle? style;
const PaymentSummaryRow({
super.key,
required this.labelFactory,
required this.asset,
this.style,
});
@override
Widget build(BuildContext context) => Text(
labelFactory(asset == null ? 'N/A' : assetToString(asset!)),
style: style,
);
}

View File

@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:pshared/models/asset.dart';
import 'package:pshared/models/currency.dart';
import 'package:pshared/provider/payment/amount.dart';
import 'package:pweb/pages/dashboard/payouts/summary/row.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
class PaymentSentAmountRow extends StatelessWidget {
final Currency currency;
const PaymentSentAmountRow({super.key, required this.currency});
@override
Widget build(BuildContext context) => Consumer<PaymentAmountProvider>(
builder: (context, provider, _) => PaymentSummaryRow(
labelFactory: AppLocalizations.of(context)!.sentAmount,
asset: Asset(currency: currency, amount: provider.amount),
style: Theme.of(context).textTheme.titleMedium,
),
);
}

View File

@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:pshared/provider/payment/quotation.dart';
import 'package:pweb/pages/dashboard/payouts/summary/row.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
class PaymentTotalRow extends StatelessWidget {
const PaymentTotalRow({super.key});
@override
Widget build(BuildContext context) => Consumer<QuotationProvider>(
builder: (context, provider, _) => PaymentSummaryRow(
labelFactory: AppLocalizations.of(context)!.total,
asset: provider.total,
style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w600),
),
);
}

View File

@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:pshared/utils/currency.dart';
import 'package:pweb/pages/dashboard/payouts/summary/fee.dart';
import 'package:pweb/pages/dashboard/payouts/summary/recipient_receives.dart';
import 'package:pweb/pages/dashboard/payouts/summary/sent_amount.dart';
import 'package:pweb/pages/dashboard/payouts/summary/total.dart';
import 'package:pweb/providers/wallets.dart';
class PaymentSummary extends StatelessWidget {
final double spacing;
const PaymentSummary({super.key, required this.spacing});
@override
Widget build(BuildContext context) => Align(
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
PaymentSentAmountRow(currency: currencyStringToCode(context.read<WalletsProvider>().selectedWallet?.tokenSymbol ?? 'USDT')),
const PaymentFeeRow(),
const PaymentRecipientReceivesRow(),
SizedBox(height: spacing),
const PaymentTotalRow(),
],
),
);
}