name ui fix and removed parts of the app that are not ready #422
@@ -1,57 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:pshared/models/payment/type.dart';
|
|
||||||
|
|
||||||
import 'package:pweb/models/control_state.dart';
|
|
||||||
import 'package:pweb/pages/dashboard/payouts/single/new_recipient/type.dart';
|
|
||||||
import 'package:pweb/utils/payment/availability.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class SinglePayout extends StatelessWidget {
|
|
||||||
final void Function(PaymentType type) onGoToPayment;
|
|
||||||
|
|
||||||
static const double _cardPadding = 30.0;
|
|
||||||
static const double _dividerPaddingVertical = 12.0;
|
|
||||||
static const double _cardBorderRadius = 12.0;
|
|
||||||
static const double _dividerThickness = 1.0;
|
|
||||||
|
|
||||||
const SinglePayout({super.key, required this.onGoToPayment});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final paymentTypes = visiblePaymentTypes;
|
|
||||||
final dividerColor = Theme.of(context).dividerColor;
|
|
||||||
|
|
||||||
return SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
child: Card(
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(_cardBorderRadius),
|
|
||||||
),
|
|
||||||
elevation: 4,
|
|
||||||
color: Theme.of(context).colorScheme.onSecondary,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(_cardPadding),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
for (int i = 0; i < paymentTypes.length; i++) ...[
|
|
||||||
PaymentTypeTile(
|
|
||||||
type: paymentTypes[i],
|
|
||||||
onSelected: onGoToPayment,
|
|
||||||
state: disabledPaymentTypes.contains(paymentTypes[i])
|
|
||||||
? ControlState.disabled
|
|
||||||
: ControlState.enabled,
|
|
||||||
),
|
|
||||||
if (i < paymentTypes.length - 1)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: _dividerPaddingVertical),
|
|
||||||
child: Divider(thickness: _dividerThickness, color: dividerColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:pshared/models/payment/type.dart';
|
|
||||||
|
|
||||||
import 'package:pweb/models/control_state.dart';
|
|
||||||
import 'package:pweb/pages/payment_methods/icon.dart';
|
|
||||||
import 'package:pweb/utils/payment/label.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class PaymentTypeTile extends StatelessWidget {
|
|
||||||
final PaymentType type;
|
|
||||||
final void Function(PaymentType type) onSelected;
|
|
||||||
final ControlState state;
|
|
||||||
|
|
||||||
const PaymentTypeTile({
|
|
||||||
super.key,
|
|
||||||
required this.type,
|
|
||||||
required this.onSelected,
|
|
||||||
this.state = ControlState.enabled,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final label = getPaymentTypeLabel(context, type);
|
|
||||||
|
|
||||||
final theme = Theme.of(context);
|
|
||||||
final isEnabled = state == ControlState.enabled;
|
|
||||||
final isDisabled = state == ControlState.disabled;
|
|
||||||
final isLoading = state == ControlState.loading;
|
|
||||||
final textColor = isDisabled
|
|
||||||
? theme.colorScheme.onSurface.withValues(alpha: 0.55)
|
|
||||||
: theme.colorScheme.onSurface;
|
|
||||||
|
|
||||||
return InkWell(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
onTap: isEnabled ? () => onSelected(type) : null,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Icon(iconForPaymentType(type), size: 24, color: textColor),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
Text(
|
|
||||||
label,
|
|
||||||
style: theme.textTheme.bodyMedium?.copyWith(color: textColor),
|
|
||||||
),
|
|
||||||
if (isLoading) ...[
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
SizedBox(
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
strokeWidth: 2,
|
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
|
||||||
theme.colorScheme.primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ import 'package:pshared/models/payment/type.dart';
|
|||||||
import 'package:pshared/models/recipient/recipient.dart';
|
import 'package:pshared/models/recipient/recipient.dart';
|
||||||
|
|
||||||
import 'package:pweb/pages/dashboard/payouts/single/address_book/widget.dart';
|
import 'package:pweb/pages/dashboard/payouts/single/address_book/widget.dart';
|
||||||
import 'package:pweb/pages/dashboard/payouts/single/new_recipient/payout.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class SinglePayoutForm extends StatelessWidget {
|
class SinglePayoutForm extends StatelessWidget {
|
||||||
@@ -17,18 +16,13 @@ class SinglePayoutForm extends StatelessWidget {
|
|||||||
required this.onGoToPayment,
|
required this.onGoToPayment,
|
||||||
});
|
});
|
||||||
|
|
||||||
static const double _spacingBetweenAddressAndForm = 20.0;
|
|
||||||
static const double _bottomSpacing = 40.0;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
AddressBookPayout(onSelected: onRecipientSelected),
|
AddressBookPayout(onSelected: onRecipientSelected),
|
||||||
const SizedBox(height: _spacingBetweenAddressAndForm),
|
//TODO Add history of recent wallets/payments
|
||||||
SinglePayout(onGoToPayment: onGoToPayment),
|
|
||||||
const SizedBox(height: _bottomSpacing),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user