added ledger as souec of funds for payouts
This commit is contained in:
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/controllers/balance_mask/wallets.dart';
|
||||
import 'package:pshared/controllers/payment/source.dart';
|
||||
import 'package:pshared/provider/payment/amount.dart';
|
||||
|
||||
import 'package:pweb/controllers/payments/amount_field.dart';
|
||||
@@ -15,15 +15,15 @@ class PaymentAmountWidget extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return ChangeNotifierProxyProvider2<
|
||||
PaymentAmountProvider,
|
||||
WalletsController,
|
||||
PaymentSourceController,
|
||||
PaymentAmountFieldController
|
||||
>(
|
||||
create: (ctx) {
|
||||
final initialAmount = ctx.read<PaymentAmountProvider>().amount;
|
||||
return PaymentAmountFieldController(initialAmount: initialAmount);
|
||||
},
|
||||
update: (ctx, amountProvider, wallets, controller) {
|
||||
controller!.update(amountProvider, wallets);
|
||||
update: (ctx, amountProvider, source, controller) {
|
||||
controller!.update(amountProvider, source);
|
||||
return controller;
|
||||
},
|
||||
child: const PaymentAmountField(),
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/methods/data.dart';
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_methods/form.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class PaymentDetailsSection extends StatelessWidget {
|
||||
final bool isFormVisible;
|
||||
final bool isEditable;
|
||||
final VoidCallback? onToggle;
|
||||
final PaymentType? selectedType;
|
||||
final PaymentMethodData? data;
|
||||
|
||||
const PaymentDetailsSection({
|
||||
super.key,
|
||||
required this.isFormVisible,
|
||||
this.onToggle,
|
||||
required this.selectedType,
|
||||
required this.data,
|
||||
required this.isEditable,
|
||||
});
|
||||
|
||||
static const double toggleSpacing = 8.0;
|
||||
static const double formVisibleSpacing = 30.0;
|
||||
static const double formHiddenSpacing = 20.0;
|
||||
static const Duration animationDuration = Duration(milliseconds: 200);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
|
||||
final toggleIcon = isFormVisible ? Icons.expand_less : Icons.expand_more;
|
||||
final toggleText = isFormVisible ? loc.hideDetails : loc.showDetails;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
if (!isEditable && onToggle != null)
|
||||
TextButton.icon(
|
||||
onPressed: onToggle,
|
||||
icon: Icon(toggleIcon, color: theme.colorScheme.primary),
|
||||
label: Text(
|
||||
toggleText,
|
||||
style: TextStyle(color: theme.colorScheme.primary),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: toggleSpacing),
|
||||
AnimatedCrossFade(
|
||||
duration: animationDuration,
|
||||
crossFadeState: isFormVisible ? CrossFadeState.showFirst : CrossFadeState.showSecond,
|
||||
firstChild: PaymentMethodForm(
|
||||
key: const ValueKey('formVisible'),
|
||||
isEditable: isEditable,
|
||||
selectedType: selectedType,
|
||||
onChanged: (_) {},
|
||||
initialData: data,
|
||||
),
|
||||
secondChild: const SizedBox.shrink(key: ValueKey('formHidden')),
|
||||
),
|
||||
SizedBox(height: isFormVisible ? formVisibleSpacing : formHiddenSpacing),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pweb/pages/dashboard/payouts/single/address_book/avatar.dart';
|
||||
|
||||
|
||||
class RecipientHeader extends StatelessWidget{
|
||||
final Recipient recipient;
|
||||
|
||||
const RecipientHeader({super.key, required this.recipient});
|
||||
|
||||
final double _avatarRadius = 20;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: RecipientAvatar(
|
||||
isVisible: false,
|
||||
name: recipient.name,
|
||||
avatarUrl: recipient.avatarUrl,
|
||||
avatarRadius: _avatarRadius,
|
||||
nameStyle: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
title: Text(recipient.name, style: theme.textTheme.titleLarge),
|
||||
subtitle: Text(recipient.email, style: theme.textTheme.bodyLarge),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,15 @@ class PaymentFeeRow extends StatelessWidget {
|
||||
|
||||
@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,
|
||||
),
|
||||
builder: (context, provider, _) {
|
||||
final fee = provider.fee;
|
||||
final l10 = AppLocalizations.of(context)!;
|
||||
return PaymentSummaryRow(
|
||||
labelFactory: l10.fee,
|
||||
asset: fee,
|
||||
value: fee == null ? l10.noFee : null,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user