Language Change
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutter_swipe_button/flutter_swipe_button.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
|
||||
|
||||
class QuickPayOutsideBankScreen extends StatefulWidget {
|
||||
final String debitAccount;
|
||||
const QuickPayOutsideBankScreen({super.key, required this.debitAccount});
|
||||
@@ -26,8 +27,28 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
final phoneController = TextEditingController();
|
||||
final amountController = TextEditingController();
|
||||
|
||||
String accountType = 'Savings';
|
||||
final List<String> transactionModes = ['NEFT', 'RTGS', 'IMPS'];
|
||||
//String accountType = 'Savings';
|
||||
late String accountType;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
setState(() {
|
||||
accountType = AppLocalizations.of(context).savings;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//final List<String> transactionModes = ['NEFT', 'RTGS', 'IMPS'];
|
||||
List<String> transactionModes(BuildContext context) {
|
||||
return [
|
||||
AppLocalizations.of(context).neft,
|
||||
AppLocalizations.of(context).rtgs,
|
||||
AppLocalizations.of(context).imps,
|
||||
];
|
||||
}
|
||||
|
||||
int selectedTransactionIndex = 0;
|
||||
|
||||
@override
|
||||
@@ -54,8 +75,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
title: const Text(
|
||||
'Quick Pay - Outside Bank',
|
||||
title: Text(
|
||||
AppLocalizations.of(context).quickPayOutsideBank,
|
||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||
),
|
||||
centerTitle: false,
|
||||
@@ -84,17 +105,18 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
const Text('Debit from:'),
|
||||
Text(AppLocalizations.of(context).debitFrom),
|
||||
Text(
|
||||
widget.debitAccount,
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||
style: const TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.w500),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Account Number',
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).accountNumber,
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
@@ -112,9 +134,9 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Account number is required';
|
||||
return AppLocalizations.of(context).accountNumberRequired;
|
||||
} else if (value.length != 11) {
|
||||
return 'Enter a valid account number';
|
||||
return AppLocalizations.of(context).validAccountNumber;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -122,8 +144,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
const SizedBox(height: 24),
|
||||
TextFormField(
|
||||
controller: confirmAccountNumberController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Confirm Account Number',
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).confirmAccountNumber,
|
||||
// prefixIcon: Icon(Icons.person),
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
@@ -140,18 +162,18 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Re-enter account number';
|
||||
return AppLocalizations.of(context).reenterAccountNumber;
|
||||
}
|
||||
if (value != accountNumberController.text) {
|
||||
return 'Account numbers do not match';
|
||||
return AppLocalizations.of(context).accountMismatch;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Name',
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).name,
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
@@ -168,15 +190,15 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Name is required';
|
||||
return AppLocalizations.of(context).nameRequired;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Beneficiary Bank Name",
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).bankName,
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
@@ -192,15 +214,15 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Beneficiary Bank Name is required';
|
||||
return AppLocalizations.of(context).bankNameRequired;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Branch Name",
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).branchName,
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
@@ -216,7 +238,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Branch Name is required';
|
||||
return AppLocalizations.of(context).branchNameRequired;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -226,8 +248,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
labelText: "IFSC Code",
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).ifscCode,
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
@@ -243,7 +265,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'IFSC Code is required';
|
||||
return AppLocalizations.of(context).ifscRequired;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -252,8 +274,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
Expanded(
|
||||
child: DropdownButtonFormField<String>(
|
||||
value: accountType,
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Account Type",
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).accountType,
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
@@ -265,7 +287,10 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||
),
|
||||
),
|
||||
items: ['Savings', 'Current']
|
||||
items: [
|
||||
AppLocalizations.of(context).savings,
|
||||
AppLocalizations.of(context).current
|
||||
]
|
||||
.map((e) => DropdownMenuItem(
|
||||
value: e,
|
||||
child: Text(e),
|
||||
@@ -285,8 +310,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
child: TextFormField(
|
||||
controller: phoneController,
|
||||
keyboardType: TextInputType.phone,
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Phone",
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).phone,
|
||||
prefixIcon: Icon(Icons.phone),
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
@@ -301,15 +326,15 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) => value == null || value.isEmpty
|
||||
? "Phone number is Required"
|
||||
? AppLocalizations.of(context).phoneRequired
|
||||
: null,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Amount',
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).amount,
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
@@ -326,11 +351,11 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Amount is required';
|
||||
return AppLocalizations.of(context).amountRequired;
|
||||
}
|
||||
final amount = double.tryParse(value);
|
||||
if (amount == null || amount <= 0) {
|
||||
return 'Enter a valid amount';
|
||||
return AppLocalizations.of(context).validAmount;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -341,7 +366,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
const SizedBox(height: 30),
|
||||
Row(
|
||||
children: [
|
||||
const Text("Transaction Mode",
|
||||
Text(AppLocalizations.of(context).transactionMode,
|
||||
style: TextStyle(fontWeight: FontWeight.w500)),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: buildTransactionModeSelector()),
|
||||
@@ -359,8 +384,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
activeTrackColor: Colors.blue.shade100,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
height: 56,
|
||||
child: const Text(
|
||||
"Swipe to Pay",
|
||||
child: Text(
|
||||
AppLocalizations.of(context).swipeToPay,
|
||||
style:
|
||||
TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
),
|
||||
@@ -368,10 +393,11 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// Perform payment logic
|
||||
final selectedMode =
|
||||
transactionModes[selectedTransactionIndex];
|
||||
transactionModes(context)[selectedTransactionIndex];
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Paying via $selectedMode...')),
|
||||
content: Text(
|
||||
'${AppLocalizations.of(context).payingVia} $selectedMode...')),
|
||||
);
|
||||
// Navigator.push(
|
||||
// context,
|
||||
@@ -395,7 +421,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Row(
|
||||
children: List.generate(transactionModes.length, (index) {
|
||||
children: List.generate(transactionModes(context).length, (index) {
|
||||
bool isSelected = selectedTransactionIndex == index;
|
||||
return Expanded(
|
||||
child: GestureDetector(
|
||||
@@ -415,7 +441,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
transactionModes[index],
|
||||
transactionModes(context)[index],
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
),
|
||||
|
Reference in New Issue
Block a user