changed imports of AppLocalization

Also added beneficiary validation while quick pay within bank
This commit is contained in:
2025-07-24 22:21:19 +05:30
parent 23d742ace9
commit 787fcdc2e2
42 changed files with 3965 additions and 1025 deletions

View File

@@ -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),
],