multiple payout page and small fixes

This commit is contained in:
Arseni
2026-02-11 02:48:30 +03:00
parent 66989ea36c
commit edb43f9909
77 changed files with 2120 additions and 1289 deletions

View File

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

View File

@@ -5,29 +5,86 @@ import 'package:provider/provider.dart';
import 'package:pshared/controllers/balance_mask/wallets.dart';
import 'package:pshared/utils/currency.dart';
import 'package:pweb/models/summary_values.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/row.dart';
import 'package:pweb/pages/dashboard/payouts/summary/sent_amount.dart';
import 'package:pweb/pages/dashboard/payouts/summary/total.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
class PaymentSummary extends StatelessWidget {
final double spacing;
final PaymentSummaryValues? values;
const PaymentSummary({super.key, required this.spacing});
const PaymentSummary({
super.key,
required this.spacing,
this.values,
});
@override
Widget build(BuildContext context) => Align(
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
PaymentSentAmountRow(currency: currencyStringToCode(context.read<WalletsController>().selectedWallet?.tokenSymbol ?? 'USDT')),
const PaymentFeeRow(),
const PaymentRecipientReceivesRow(),
SizedBox(height: spacing),
const PaymentTotalRow(),
],
),
);
}
Widget build(BuildContext context) {
final resolvedValues = values;
if (resolvedValues != null) {
final theme = Theme.of(context);
final loc = AppLocalizations.of(context)!;
return Align(
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
PaymentSummaryRow(
labelFactory: loc.sentAmount,
asset: null,
value: resolvedValues.sentAmount,
style: theme.textTheme.titleMedium,
),
PaymentSummaryRow(
labelFactory: loc.fee,
asset: null,
value: resolvedValues.fee,
style: theme.textTheme.titleMedium,
),
PaymentSummaryRow(
labelFactory: loc.recipientWillReceive,
asset: null,
value: resolvedValues.recipientReceives,
style: theme.textTheme.titleMedium,
),
SizedBox(height: spacing),
PaymentSummaryRow(
labelFactory: loc.total,
asset: null,
value: resolvedValues.total,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w600,
),
),
],
),
);
}
return Align(
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
PaymentSentAmountRow(
currency: currencyStringToCode(
context.read<WalletsController>().selectedWallet?.tokenSymbol ??
'USDT',
),
),
const PaymentFeeRow(),
const PaymentRecipientReceivesRow(),
SizedBox(height: spacing),
const PaymentTotalRow(),
],
),
);
}
}