improving VMC flow
This commit is contained in:
@@ -13,8 +13,6 @@ import 'package:skeletonizer/skeletonizer.dart';
|
||||
import 'package:qpay/screens/recipient/recipients_controller.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../onboarding/auth_provider.dart';
|
||||
|
||||
class RecipientsScreen extends StatefulWidget {
|
||||
const RecipientsScreen({super.key});
|
||||
|
||||
@@ -87,6 +85,26 @@ class _RecipientsScreenState extends State<RecipientsScreen>
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
_applyRecipient(Recipient recipient) {
|
||||
String account = recipient.account ?? '';
|
||||
if (!transactionController.model.selectedProvider!.requiresAccount) {
|
||||
account = recipient.phoneNumber ?? '';
|
||||
}
|
||||
transactionController.model.formData = transactionController.model.formData
|
||||
.copyWith(
|
||||
creditAccount: account,
|
||||
creditName: recipient.name ?? '',
|
||||
creditPhone: recipient.phoneNumber ?? '',
|
||||
creditEmail: recipient.email ?? '',
|
||||
providerLabel:
|
||||
transactionController.model.formData.providerLabel.isEmpty
|
||||
? recipient.latestProviderLabel ?? ''
|
||||
: transactionController.model.formData.providerLabel,
|
||||
);
|
||||
if (!mounted) return;
|
||||
context.push("/make-payment");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -330,32 +348,7 @@ class _RecipientsScreenState extends State<RecipientsScreen>
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
String account = recipient.account ?? '';
|
||||
if (!transactionController
|
||||
.model
|
||||
.selectedProvider!
|
||||
.requiresAccount) {
|
||||
account = recipient.phoneNumber ?? '';
|
||||
}
|
||||
transactionController
|
||||
.model
|
||||
.formData = transactionController.model.formData.copyWith(
|
||||
creditAccount: account,
|
||||
creditName: recipient.name ?? '',
|
||||
creditPhone: recipient.phoneNumber ?? '',
|
||||
creditEmail: recipient.email ?? '',
|
||||
providerLabel:
|
||||
transactionController
|
||||
.model
|
||||
.formData
|
||||
.providerLabel
|
||||
.isEmpty
|
||||
? recipient.latestProviderLabel ?? ''
|
||||
: transactionController.model.formData.providerLabel,
|
||||
);
|
||||
context.push("/make-payment");
|
||||
},
|
||||
onTap: () => _applyRecipient(recipient),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
|
||||
Reference in New Issue
Block a user