redesigned payment page + a lot of fixes
This commit is contained in:
@@ -30,8 +30,13 @@ class SourceWalletSelector extends StatelessWidget {
|
||||
return Text(l10n.noWalletsAvailable, style: theme.textTheme.bodySmall);
|
||||
}
|
||||
|
||||
final effectiveSelectedWalletRef = selectedWalletRef != null &&
|
||||
wallets.any((wallet) => wallet.id == selectedWalletRef)
|
||||
? selectedWalletRef
|
||||
: null;
|
||||
|
||||
return DropdownButtonFormField<String>(
|
||||
initialValue: selectedWalletRef,
|
||||
initialValue: effectiveSelectedWalletRef,
|
||||
isExpanded: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.whereGetMoney,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/models/visibility.dart';
|
||||
import 'package:pweb/models/state/visibility.dart';
|
||||
|
||||
|
||||
class BalanceRefreshButton extends StatelessWidget {
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/provider/ledger.dart';
|
||||
|
||||
import 'package:pweb/models/visibility.dart';
|
||||
import 'package:pweb/models/state/visibility.dart';
|
||||
import 'package:pweb/widgets/refresh_balance/button.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/provider/payment/wallets.dart';
|
||||
|
||||
import 'package:pweb/models/visibility.dart';
|
||||
import 'package:pweb/models/state/visibility.dart';
|
||||
import 'package:pweb/widgets/refresh_balance/button.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/models/role_draft.dart';
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
Future<RoleDraft?> showCreateRoleDialog(BuildContext context) {
|
||||
return showDialog<RoleDraft>(
|
||||
context: context,
|
||||
builder: (dialogContext) => const _CreateRoleDialog(),
|
||||
);
|
||||
}
|
||||
|
||||
class _CreateRoleDialog extends StatefulWidget {
|
||||
const _CreateRoleDialog();
|
||||
|
||||
@override
|
||||
State<_CreateRoleDialog> createState() => _CreateRoleDialogState();
|
||||
}
|
||||
|
||||
class _CreateRoleDialogState extends State<_CreateRoleDialog> {
|
||||
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
final TextEditingController _nameController = TextEditingController();
|
||||
final TextEditingController _descriptionController = TextEditingController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_nameController.dispose();
|
||||
_descriptionController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _submit() {
|
||||
final form = _formKey.currentState;
|
||||
if (form == null || !form.validate()) return;
|
||||
Navigator.of(context).pop(RoleDraft(
|
||||
name: _nameController.text.trim(),
|
||||
description: _descriptionController.text.trim(),
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
return AlertDialog(
|
||||
title: Text(loc.invitationAddRoleTitle),
|
||||
content: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: _nameController,
|
||||
decoration: InputDecoration(
|
||||
labelText: loc.invitationRoleNameLabel,
|
||||
),
|
||||
validator: (value) => (value == null || value.trim().isEmpty)
|
||||
? loc.invitationRoleNameRequired
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
controller: _descriptionController,
|
||||
minLines: 2,
|
||||
maxLines: 3,
|
||||
decoration: InputDecoration(
|
||||
labelText: loc.invitationRoleDescriptionLabel,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(loc.cancel),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: _submit,
|
||||
child: Text(loc.add),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ class PageSelector extends StatelessWidget {
|
||||
final byName = PayoutRoutes.destinationFor(state.name);
|
||||
if (byName != null) return byName;
|
||||
|
||||
final location = state.matchedLocation;
|
||||
final location = state.uri.path;
|
||||
if (location.startsWith(PayoutRoutes.editWalletPath)) {
|
||||
return PayoutDestination.editwallet;
|
||||
}
|
||||
@@ -98,6 +98,9 @@ class PageSelector extends StatelessWidget {
|
||||
if (location.startsWith(PayoutRoutes.paymentPath)) {
|
||||
return PayoutDestination.payment;
|
||||
}
|
||||
if (location.startsWith(PayoutRoutes.editRecipientPath)) {
|
||||
return PayoutDestination.addrecipient;
|
||||
}
|
||||
if (location.startsWith(PayoutRoutes.addRecipientPath)) {
|
||||
return PayoutDestination.addrecipient;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/controllers/email.dart';
|
||||
import 'package:pweb/controllers/auth/email.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user