changed imports of AppLocalization
Also added beneficiary validation while quick pay within bank
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
|
||||
class AddBeneficiaryScreen extends StatefulWidget {
|
||||
const AddBeneficiaryScreen({super.key});
|
||||
@@ -56,9 +56,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
onPressed: () {
|
||||
// Navigate to Payment Screen or do something
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: Colors.blue[200],
|
||||
),
|
||||
style: TextButton.styleFrom(foregroundColor: Colors.blue[200]),
|
||||
child: Text(AppLocalizations.of(context).payNow),
|
||||
),
|
||||
IconButton(
|
||||
@@ -88,7 +86,8 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
return;
|
||||
}
|
||||
await Future.delayed(
|
||||
const Duration(seconds: 2)); //Mock delay for 2 sec to imitate api call
|
||||
const Duration(seconds: 2),
|
||||
); //Mock delay for 2 sec to imitate api call
|
||||
// 🔹 Mock IFSC lookup (you can replace this with API)
|
||||
const mockIfscData = {
|
||||
'KCCB0001234': {
|
||||
@@ -170,8 +169,9 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
TextFormField(
|
||||
controller: accountNumberController,
|
||||
decoration: InputDecoration(
|
||||
labelText:
|
||||
AppLocalizations.of(context).accountNumber,
|
||||
labelText: AppLocalizations.of(
|
||||
context,
|
||||
).accountNumber,
|
||||
// prefixIcon: Icon(Icons.person),
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
@@ -181,8 +181,10 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 2),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
obscureText: true,
|
||||
@@ -190,8 +192,9 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.length < 10) {
|
||||
return AppLocalizations.of(context)
|
||||
.enterValidAccountNumber;
|
||||
return AppLocalizations.of(
|
||||
context,
|
||||
).enterValidAccountNumber;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -201,8 +204,9 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
TextFormField(
|
||||
controller: confirmAccountNumberController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)
|
||||
.confirmAccountNumber,
|
||||
labelText: AppLocalizations.of(
|
||||
context,
|
||||
).confirmAccountNumber,
|
||||
// prefixIcon: Icon(Icons.person),
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
@@ -212,20 +216,24 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 2),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return AppLocalizations.of(context)
|
||||
.reenterAccountNumber;
|
||||
return AppLocalizations.of(
|
||||
context,
|
||||
).reenterAccountNumber;
|
||||
}
|
||||
if (value != accountNumberController.text) {
|
||||
return AppLocalizations.of(context)
|
||||
.accountMismatch;
|
||||
return AppLocalizations.of(
|
||||
context,
|
||||
).accountMismatch;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -244,8 +252,10 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 2),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
@@ -371,8 +381,10 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 2),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
@@ -392,10 +404,12 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
final pattern = RegExp(r'^[A-Z]{4}0[A-Z0-9]{6}$');
|
||||
if (value == null || value.trim().isEmpty) {
|
||||
return AppLocalizations.of(context).enterIfsc;
|
||||
} else if (!pattern
|
||||
.hasMatch(value.trim().toUpperCase())) {
|
||||
return AppLocalizations.of(context)
|
||||
.invalidIfscFormat;
|
||||
} else if (!pattern.hasMatch(
|
||||
value.trim().toUpperCase(),
|
||||
)) {
|
||||
return AppLocalizations.of(
|
||||
context,
|
||||
).invalidIfscFormat;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -416,8 +430,10 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 2),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -437,8 +453,10 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 2),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -457,19 +475,24 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 2),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
items: [
|
||||
AppLocalizations.of(context).savings,
|
||||
AppLocalizations.of(context).current
|
||||
]
|
||||
.map((type) => DropdownMenuItem(
|
||||
value: type,
|
||||
child: Text(type),
|
||||
))
|
||||
.toList(),
|
||||
items:
|
||||
[
|
||||
AppLocalizations.of(context).savings,
|
||||
AppLocalizations.of(context).current,
|
||||
]
|
||||
.map(
|
||||
(type) => DropdownMenuItem(
|
||||
value: type,
|
||||
child: Text(type),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
accountType = value!;
|
||||
@@ -492,15 +515,17 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 2),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
textInputAction: TextInputAction.done,
|
||||
validator: (value) =>
|
||||
value == null || value.length != 10
|
||||
? AppLocalizations.of(context).enterValidPhone
|
||||
: null,
|
||||
? AppLocalizations.of(context).enterValidPhone
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 35),
|
||||
],
|
||||
|
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:kmobile/features/beneficiaries/screens/add_beneficiary_screen.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
|
||||
class ManageBeneficiariesScreen extends StatefulWidget {
|
||||
const ManageBeneficiariesScreen({super.key});
|
||||
@@ -14,22 +14,10 @@ class ManageBeneficiariesScreen extends StatefulWidget {
|
||||
|
||||
class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
||||
final List<Map<String, String>> beneficiaries = [
|
||||
{
|
||||
'bank': 'State Bank Of India',
|
||||
'name': 'Trina Bakshi',
|
||||
},
|
||||
{
|
||||
'bank': 'State Bank Of India',
|
||||
'name': 'Sheetal Rao',
|
||||
},
|
||||
{
|
||||
'bank': 'Punjab National Bank',
|
||||
'name': 'Manoj Kumar',
|
||||
},
|
||||
{
|
||||
'bank': 'State Bank Of India',
|
||||
'name': 'Rohit Mehra',
|
||||
},
|
||||
{'bank': 'State Bank Of India', 'name': 'Trina Bakshi'},
|
||||
{'bank': 'State Bank Of India', 'name': 'Sheetal Rao'},
|
||||
{'bank': 'Punjab National Bank', 'name': 'Manoj Kumar'},
|
||||
{'bank': 'State Bank Of India', 'name': 'Rohit Mehra'},
|
||||
];
|
||||
|
||||
@override
|
||||
@@ -71,7 +59,9 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
||||
final beneficiary = beneficiaries[index];
|
||||
return ListTile(
|
||||
leading: const CircleAvatar(
|
||||
backgroundColor: Colors.blue, child: Text('A')),
|
||||
backgroundColor: Colors.blue,
|
||||
child: Text('A'),
|
||||
),
|
||||
title: Text(beneficiary['name']!),
|
||||
subtitle: Text(beneficiary['bank']!),
|
||||
trailing: IconButton(
|
||||
@@ -89,9 +79,11 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
||||
child: FloatingActionButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const AddBeneficiaryScreen()));
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const AddBeneficiaryScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: Colors.grey[300],
|
||||
foregroundColor: Colors.blue[900],
|
||||
|
Reference in New Issue
Block a user