implemented TPIN and quick pay within bank
This commit is contained in:
@@ -6,7 +6,8 @@ import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
import '../../fund_transfer/screens/transaction_pin_screen.dart';
|
||||
|
||||
class QuickPayOutsideBankScreen extends StatefulWidget {
|
||||
const QuickPayOutsideBankScreen({super.key});
|
||||
final String debitAccount;
|
||||
const QuickPayOutsideBankScreen({super.key, required this.debitAccount});
|
||||
|
||||
@override
|
||||
State<QuickPayOutsideBankScreen> createState() =>
|
||||
@@ -82,12 +83,12 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
child: ListView(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
const Row(
|
||||
Row(
|
||||
children: [
|
||||
Text('Debit from:'),
|
||||
const Text('Debit from:'),
|
||||
Text(
|
||||
'0300015678903456',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||
widget.debitAccount,
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||
)
|
||||
],
|
||||
),
|
||||
@@ -113,7 +114,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Account number is required';
|
||||
} else if (value.length != 16) {
|
||||
} else if (value.length != 11) {
|
||||
return 'Enter a valid account number';
|
||||
}
|
||||
return null;
|
||||
@@ -373,11 +374,14 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
SnackBar(
|
||||
content: Text('Paying via $selectedMode...')),
|
||||
);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
const TransactionPinScreen()));
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// const TransactionPinScreen(
|
||||
// transactionData: {},
|
||||
// transactionCode: 'PAYMENT',
|
||||
// )));
|
||||
}
|
||||
},
|
||||
)),
|
||||
|
@@ -5,7 +5,8 @@ import 'package:kmobile/features/quick_pay/screens/quick_pay_within_bank_screen.
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
|
||||
class QuickPayScreen extends StatefulWidget {
|
||||
const QuickPayScreen({super.key});
|
||||
final String debitAccount;
|
||||
const QuickPayScreen({super.key, required this.debitAccount});
|
||||
|
||||
@override
|
||||
State<QuickPayScreen> createState() => _QuickPayScreen();
|
||||
@@ -52,20 +53,21 @@ class _QuickPayScreen extends State<QuickPayScreen> {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const QuickPayWithinBankScreen()));
|
||||
builder: (context) => QuickPayWithinBankScreen(debitAccount: widget.debitAccount)));
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 1,
|
||||
),
|
||||
QuickPayManagementTile(
|
||||
disable: true,
|
||||
icon: Symbols.output_circle,
|
||||
label: 'Outside Bank',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const QuickPayOutsideBankScreen()));
|
||||
builder: (context) => QuickPayOutsideBankScreen(debitAccount: widget.debitAccount)));
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
@@ -81,12 +83,14 @@ class QuickPayManagementTile extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
final bool disable;
|
||||
|
||||
const QuickPayManagementTile({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.onTap,
|
||||
this.disable = false,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -96,6 +100,7 @@ class QuickPayManagementTile extends StatelessWidget {
|
||||
title: Text(label),
|
||||
trailing: const Icon(Symbols.arrow_right, size: 20),
|
||||
onTap: onTap,
|
||||
enabled: !disable,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutter_swipe_button/flutter_swipe_button.dart';
|
||||
import 'package:kmobile/data/models/transfer.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
|
||||
import '../../fund_transfer/screens/transaction_pin_screen.dart';
|
||||
|
||||
class QuickPayWithinBankScreen extends StatefulWidget {
|
||||
const QuickPayWithinBankScreen({super.key});
|
||||
final String debitAccount;
|
||||
const QuickPayWithinBankScreen({super.key, required this.debitAccount});
|
||||
|
||||
@override
|
||||
State<QuickPayWithinBankScreen> createState() => _QuickPayWithinBankScreen();
|
||||
@@ -18,8 +20,8 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
final TextEditingController accountNumberController = TextEditingController();
|
||||
final TextEditingController confirmAccountNumberController =
|
||||
TextEditingController();
|
||||
final TextEditingController nameController = TextEditingController();
|
||||
final TextEditingController amountController = TextEditingController();
|
||||
String? _selectedAccountType;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -59,14 +61,19 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
const Row(
|
||||
children: [
|
||||
Text('Debit from:'),
|
||||
Text(
|
||||
'0300015678903456',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||
)
|
||||
],
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Debit Account Number',
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
),
|
||||
readOnly: true,
|
||||
controller: TextEditingController(text: widget.debitAccount),
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.next,
|
||||
enabled: false,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
TextFormField(
|
||||
@@ -90,21 +97,21 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Account number is required';
|
||||
} else if (value.length != 16) {
|
||||
} else if (value.length != 11) {
|
||||
return 'Enter a valid account number';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 15.0, top: 5),
|
||||
child: Text(
|
||||
'Beneficiary Account Number',
|
||||
style: TextStyle(color: Colors.black54),
|
||||
),
|
||||
)),
|
||||
// const Align(
|
||||
// alignment: Alignment.topLeft,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.only(left: 15.0, top: 5),
|
||||
// child: Text(
|
||||
// 'Beneficiary Account Number',
|
||||
// style: TextStyle(color: Colors.black54),
|
||||
// ),
|
||||
// )),
|
||||
const SizedBox(height: 25),
|
||||
TextFormField(
|
||||
controller: confirmAccountNumberController,
|
||||
@@ -135,9 +142,9 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
TextFormField(
|
||||
DropdownButtonFormField<String>(
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Name',
|
||||
labelText: 'Beneficiary Account Type',
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
@@ -149,25 +156,38 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||
),
|
||||
),
|
||||
controller: nameController,
|
||||
keyboardType: TextInputType.name,
|
||||
textInputAction: TextInputAction.next,
|
||||
value: _selectedAccountType,
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: 'SB',
|
||||
child: Text('Savings'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'LN',
|
||||
child: Text('Loan'),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedAccountType = value;
|
||||
});
|
||||
},
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Name is required';
|
||||
return 'Please select account type';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 15.0, top: 5),
|
||||
child: Text(
|
||||
'Beneficiary Name',
|
||||
style: TextStyle(color: Colors.black54),
|
||||
),
|
||||
)),
|
||||
// const Align(
|
||||
// alignment: Alignment.topLeft,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.only(left: 15.0, top: 5),
|
||||
// child: Text(
|
||||
// 'Beneficiary Account Type',
|
||||
// style: TextStyle(color: Colors.black54),
|
||||
// ),
|
||||
// )),
|
||||
const SizedBox(height: 25),
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
@@ -205,29 +225,48 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
Icons.arrow_forward,
|
||||
color: Colors.white,
|
||||
),
|
||||
activeThumbColor: Colors.blue[900],
|
||||
activeTrackColor: Colors.blue.shade100,
|
||||
activeThumbColor: Theme.of(context).primaryColor,
|
||||
activeTrackColor:
|
||||
Theme.of(context).colorScheme.secondary.withAlpha(100),
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
height: 56,
|
||||
child: const Text(
|
||||
"Swipe to Pay",
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
onSwipe: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// Perform payment logic
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Processing Payment...')),
|
||||
);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
const TransactionPinScreen()));
|
||||
builder: (context) => TransactionPinScreen(
|
||||
transactionData: Transfer(
|
||||
fromAccount: widget.debitAccount,
|
||||
toAccount: accountNumberController.text,
|
||||
toAccountType: _selectedAccountType!,
|
||||
amount: amountController.text,
|
||||
),
|
||||
)));
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
// SliderButton(
|
||||
// action: () async {
|
||||
// ///Do something here OnSlide
|
||||
// return true;
|
||||
// },
|
||||
// label: const Text(
|
||||
// "Slide to pay",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xff4a4a4a),
|
||||
// fontWeight: FontWeight.w500,
|
||||
// fontSize: 17),
|
||||
// ),
|
||||
// icon: Icon(Symbols.arrow_forward,
|
||||
// color: Theme.of(context).primaryColor, weight: 200),
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user