Localization changes #4

This commit is contained in:
2025-08-28 13:28:21 +05:30
parent 0d629226a8
commit a33b4bc1e1
10 changed files with 430 additions and 402 deletions

View File

@@ -11,7 +11,11 @@ import 'transaction_details_screen.dart';
class AccountStatementScreen extends StatefulWidget { class AccountStatementScreen extends StatefulWidget {
final String accountNo; final String accountNo;
final String balance; final String balance;
const AccountStatementScreen({super.key, required this.accountNo, required this.balance,}); const AccountStatementScreen({
super.key,
required this.accountNo,
required this.balance,
});
@override @override
State<AccountStatementScreen> createState() => _AccountStatementScreen(); State<AccountStatementScreen> createState() => _AccountStatementScreen();
@@ -167,7 +171,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
fontSize: 17, fontSize: 17,
), ),
), ),
Text('${widget.balance}', style: const TextStyle(fontSize: 17)), Text('${widget.balance}',
style: const TextStyle(fontSize: 17)),
], ],
), ),
const SizedBox(height: 15), const SizedBox(height: 15),

View File

@@ -46,7 +46,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() { setState(() {
accountType = AppLocalizations.of(context).savings; accountType = 'Savings';
}); });
}); });
} }
@@ -87,13 +87,11 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
final service = getIt<BeneficiaryService>(); final service = getIt<BeneficiaryService>();
try { try {
String beneficiaryName; String beneficiaryName;
if (ifsc.toLowerCase().contains('kace')) { if (ifsc.toLowerCase().contains('kace')) {
beneficiaryName = await service.validateBeneficiaryWithinBank(accountNo); beneficiaryName =
} await service.validateBeneficiaryWithinBank(accountNo);
} else {
else{
beneficiaryName = await service.validateBeneficiary( beneficiaryName = await service.validateBeneficiary(
accountNo: accountNo, accountNo: accountNo,
ifscCode: ifsc, ifscCode: ifsc,
@@ -129,8 +127,9 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
// Ensure beneficiary is validated before proceeding to TPIN // Ensure beneficiary is validated before proceeding to TPIN
if (!_isBeneficiaryValidated) { if (!_isBeneficiaryValidated) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
const SnackBar( SnackBar(
content: Text('Please validate beneficiary details first.')), content: Text(AppLocalizations.of(context)
.pleaseValidateBeneficiaryDetailsFirst)),
); );
return; return;
} }
@@ -517,8 +516,8 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
), ),
), ),
items: [ items: [
AppLocalizations.of(context).savings, 'Savings',
AppLocalizations.of(context).current, 'Current',
] ]
.map( .map(
(type) => DropdownMenuItem( (type) => DropdownMenuItem(

View File

@@ -4,6 +4,8 @@ import 'package:kmobile/di/injection.dart';
import 'package:kmobile/widgets/bank_logos.dart'; import 'package:kmobile/widgets/bank_logos.dart';
import 'package:kmobile/api/services/beneficiary_service.dart'; import 'package:kmobile/api/services/beneficiary_service.dart';
import '../../../l10n/app_localizations.dart';
class BeneficiaryDetailsScreen extends StatelessWidget { class BeneficiaryDetailsScreen extends StatelessWidget {
final Beneficiary beneficiary; final Beneficiary beneficiary;
@@ -17,7 +19,9 @@ class BeneficiaryDetailsScreen extends StatelessWidget {
_showSuccessDialog(context); _showSuccessDialog(context);
} catch (e) { } catch (e) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Failed to delete beneficiary: $e')), SnackBar(
content: Text(
'${AppLocalizations.of(context).failedToDeleteBeneficiary}: $e')),
); );
} }
} }
@@ -27,11 +31,12 @@ void _showSuccessDialog(BuildContext context) {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: const Text('Success'), title: Text(AppLocalizations.of(context).success),
content: const Text('Beneficiary deleted successfully.'), content:
Text(AppLocalizations.of(context).beneficiaryDeletedSuccessfully),
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: const Text('OK'), child: Text(AppLocalizations.of(context).ok),
onPressed: () { onPressed: () {
Navigator.of(context).popUntil((route) => route.isFirst); Navigator.of(context).popUntil((route) => route.isFirst);
}, },
@@ -47,18 +52,18 @@ void _showDeleteConfirmationDialog(BuildContext context) {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: const Text('Delete Beneficiary'), title: Text(AppLocalizations.of(context).deleteBeneficiary),
content: content: Text(AppLocalizations.of(context)
const Text('Are you sure you want to delete this beneficiary?'), .areYouSureYouWantToDeleteThisBeneficiary),
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: const Text('Cancel'), child: Text(AppLocalizations.of(context).cancel),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),
TextButton( TextButton(
child: const Text('Delete'), child: Text(AppLocalizations.of(context).delete),
onPressed: () { onPressed: () {
//Navigator.of(context).pop(); //Navigator.of(context).pop();
_deleteBeneficiary(context); _deleteBeneficiary(context);
@@ -68,11 +73,13 @@ void _showDeleteConfirmationDialog(BuildContext context) {
); );
}, },
); );
} @override }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Beneficiary Details'), title: Text(AppLocalizations.of(context).beneficiarydetails),
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
@@ -95,11 +102,16 @@ void _showDeleteConfirmationDialog(BuildContext context) {
], ],
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
_buildDetailRow('Beneficiary Name', beneficiary.bankName ?? 'N/A'), _buildDetailRow('${AppLocalizations.of(context).bankName} ',
_buildDetailRow('Account No.', beneficiary.accountNo), beneficiary.bankName ?? 'N/A'),
_buildDetailRow('Account Type', beneficiary.accountType), _buildDetailRow('${AppLocalizations.of(context).accountNumber} ',
_buildDetailRow('IFSC Code', beneficiary.ifscCode), beneficiary.accountNo),
_buildDetailRow('Branch Name', beneficiary.branchName ?? 'N/A'), _buildDetailRow('${AppLocalizations.of(context).accountType} ',
beneficiary.accountType),
_buildDetailRow('${AppLocalizations.of(context).ifscCode} ',
beneficiary.ifscCode),
_buildDetailRow('${AppLocalizations.of(context).branchName} ',
beneficiary.branchName ?? 'N/A'),
const Spacer(), const Spacer(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
@@ -117,7 +129,7 @@ void _showDeleteConfirmationDialog(BuildContext context) {
_showDeleteConfirmationDialog(context); _showDeleteConfirmationDialog(context);
}, },
icon: const Icon(Icons.delete), icon: const Icon(Icons.delete),
label: const Text('Delete'), label: Text(AppLocalizations.of(context).delete),
), ),
], ],
), ),

View File

@@ -523,8 +523,10 @@ class _DashboardScreenState extends State<DashboardScreen> {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
AccountStatementScreen( AccountStatementScreen(
accountNo: users[selectedAccountIndex].accountNo!, accountNo: users[selectedAccountIndex]
balance: users[selectedAccountIndex].availableBalance!, .accountNo!,
balance: users[selectedAccountIndex]
.availableBalance!,
))); )));
}), }),
_buildQuickLink(Symbols.checkbook, _buildQuickLink(Symbols.checkbook,

View File

@@ -130,7 +130,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
final neftResponse = final neftResponse =
await neftService.processNeftTransaction(neftTx); await neftService.processNeftTransaction(neftTx);
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: neftResponse.message.toUpperCase() == 'SUCCESS', isSuccess:
neftResponse.message.toUpperCase() == 'SUCCESS',
date: DateTime.now(), date: DateTime.now(),
creditedAccount: neftTx.toAccount, creditedAccount: neftTx.toAccount,
amount: neftTx.amount, amount: neftTx.amount,
@@ -208,7 +209,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
final impsResponse = final impsResponse =
await impsService.processImpsTransaction(impsTx); await impsService.processImpsTransaction(impsTx);
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: impsResponse.message.toUpperCase() == 'SUCCESS', isSuccess:
impsResponse.message.toUpperCase() == 'SUCCESS',
date: DateTime.now(), date: DateTime.now(),
creditedAccount: impsTx.toAccount, creditedAccount: impsTx.toAccount,
amount: impsTx.amount, amount: impsTx.amount,
@@ -268,7 +270,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
final rtgsResponse = final rtgsResponse =
await rtgsService.processRtgsTransaction(rtgsTx); await rtgsService.processRtgsTransaction(rtgsTx);
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: rtgsResponse.message.toUpperCase() == 'SUCCESS', isSuccess:
rtgsResponse.message.toUpperCase() == 'SUCCESS',
date: DateTime.now(), date: DateTime.now(),
creditedAccount: rtgsTx.toAccount, creditedAccount: rtgsTx.toAccount,
amount: rtgsTx.amount, amount: rtgsTx.amount,
@@ -392,7 +395,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
color: Theme.of(context).colorScheme.onSurface, color: Theme.of(context).colorScheme.onSurface,
borderColor: Colors.transparent, borderColor: Colors.transparent,
selectedBorderColor: Colors.transparent, selectedBorderColor: Colors.transparent,
splashColor: Theme.of(context).primaryColor.withOpacity(0.1), splashColor:
Theme.of(context).primaryColor.withOpacity(0.1),
highlightColor: highlightColor:
Theme.of(context).primaryColor.withOpacity(0.05), Theme.of(context).primaryColor.withOpacity(0.05),
children: [ children: [

View File

@@ -22,7 +22,7 @@ class ColorThemeDialog extends StatelessWidget {
), ),
ListTile( ListTile(
leading: const CircleAvatar(backgroundColor: Colors.green), leading: const CircleAvatar(backgroundColor: Colors.green),
title: const Text('Green'), title: Text(AppLocalizations.of(context).green),
onTap: () { onTap: () {
context.read<ThemeCubit>().changeTheme(ThemeType.green); context.read<ThemeCubit>().changeTheme(ThemeType.green);
Navigator.pop(context); Navigator.pop(context);
@@ -30,7 +30,7 @@ class ColorThemeDialog extends StatelessWidget {
), ),
ListTile( ListTile(
leading: const CircleAvatar(backgroundColor: Colors.orange), leading: const CircleAvatar(backgroundColor: Colors.orange),
title: const Text('Orange'), title: Text(AppLocalizations.of(context).orange),
onTap: () { onTap: () {
context.read<ThemeCubit>().changeTheme(ThemeType.orange); context.read<ThemeCubit>().changeTheme(ThemeType.orange);
Navigator.pop(context); Navigator.pop(context);

View File

@@ -53,7 +53,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() { setState(() {
accountType = AppLocalizations.of(context).savings; accountType = 'Savings';
}); });
}); });
} }
@@ -572,8 +572,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
), ),
), ),
items: [ items: [
AppLocalizations.of(context).savings, 'Savings',
AppLocalizations.of(context).current, 'Current',
] ]
.map( .map(
(e) => DropdownMenuItem(value: e, child: Text(e)), (e) => DropdownMenuItem(value: e, child: Text(e)),

View File

@@ -285,5 +285,8 @@
"areYouSureYouWantToDeleteThisBeneficiary": "Are you sure you want to delete this beneficiary?", "areYouSureYouWantToDeleteThisBeneficiary": "Are you sure you want to delete this beneficiary?",
"yourAccountDoesNotHaveSufficientBalance": "Your account does not have sufficient balance", "yourAccountDoesNotHaveSufficientBalance": "Your account does not have sufficient balance",
"green": "Green", "green": "Green",
"orange": "Orange" "orange": "Orange",
"deleteBeneficiary": "Delete Beneficiary",
"beneficiarydetails": "Beneficiary Details",
"delete": "Delete"
} }

View File

@@ -285,5 +285,8 @@
"areYouSureYouWantToDeleteThisBeneficiary": "क्या आप वाकई इस लाभार्थी को हटाना चाहते हैं?", "areYouSureYouWantToDeleteThisBeneficiary": "क्या आप वाकई इस लाभार्थी को हटाना चाहते हैं?",
"yourAccountDoesNotHaveSufficientBalance": "आपके खाते में पर्याप्त शेष राशि नहीं है", "yourAccountDoesNotHaveSufficientBalance": "आपके खाते में पर्याप्त शेष राशि नहीं है",
"green": "हरा", "green": "हरा",
"orange": "नारंगी" "orange": "नारंगी",
"deleteBeneficiary": "लाभार्थी हटाएं",
"beneficiarydetails": "लाभार्थी विवरण",
"delete": "मिटाओ"
} }