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

@@ -2,14 +2,17 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:kmobile/data/models/user.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 AccountInfoScreen extends StatefulWidget {
final List<User> users;
final int selectedIndex;
const AccountInfoScreen(
{super.key, required this.users, required this.selectedIndex});
const AccountInfoScreen({
super.key,
required this.users,
required this.selectedIndex,
});
@override
State<AccountInfoScreen> createState() => _AccountInfoScreen();
@@ -37,8 +40,10 @@ class _AccountInfoScreen extends State<AccountInfoScreen> {
),
title: Text(
AppLocalizations.of(context).accountInfo,
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
style: const TextStyle(
color: Colors.black,
fontWeight: FontWeight.w500,
),
),
centerTitle: false,
actions: [
@@ -62,10 +67,7 @@ class _AccountInfoScreen extends State<AccountInfoScreen> {
children: [
Text(
AppLocalizations.of(context).accountNumber,
style: const TextStyle(
fontWeight: FontWeight.w500,
fontSize: 14,
),
style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 14),
),
/// Dropdown to change account
@@ -93,25 +95,32 @@ class _AccountInfoScreen extends State<AccountInfoScreen> {
// InfoRow(title: 'SMS Service', value: user.smsService),
// InfoRow(title: 'Missed Call Service', value: user.missedCallService),*/
InfoRow(
title: AppLocalizations.of(context).customerNumber,
value: selectedUser.cifNumber ?? 'N/A'),
title: AppLocalizations.of(context).customerNumber,
value: selectedUser.cifNumber ?? 'N/A',
),
InfoRow(
title: AppLocalizations.of(context).productName,
value: selectedUser.productType ?? 'N/A'),
title: AppLocalizations.of(context).productName,
value: selectedUser.productType ?? 'N/A',
),
// InfoRow(title: 'Account Opening Date', value: users[selectedIndex].accountOpeningDate ?? 'N/A'),
InfoRow(
title: AppLocalizations.of(context).accountStatus, value: 'OPEN'),
title: AppLocalizations.of(context).accountStatus,
value: 'OPEN',
),
InfoRow(
title: AppLocalizations.of(context).availableBalance,
value: selectedUser.availableBalance ?? 'N/A'),
title: AppLocalizations.of(context).availableBalance,
value: selectedUser.availableBalance ?? 'N/A',
),
InfoRow(
title: AppLocalizations.of(context).currentBalance,
value: selectedUser.currentBalance ?? 'N/A'),
title: AppLocalizations.of(context).currentBalance,
value: selectedUser.currentBalance ?? 'N/A',
),
users[selectedIndex].approvedAmount != null
? InfoRow(
title: AppLocalizations.of(context).approvedAmount,
value: selectedUser.approvedAmount ?? 'N/A')
value: selectedUser.approvedAmount ?? 'N/A',
)
: const SizedBox.shrink(),
],
),
@@ -144,10 +153,7 @@ class InfoRow extends StatelessWidget {
const SizedBox(height: 3),
Text(
value,
style: const TextStyle(
fontSize: 16,
color: Colors.black,
),
style: const TextStyle(fontSize: 16, color: Colors.black),
),
],
),

View File

@@ -5,14 +5,11 @@ import 'package:shimmer/shimmer.dart';
import 'package:kmobile/data/models/transaction.dart';
import 'package:kmobile/data/repositories/transaction_repository.dart';
import 'package:kmobile/di/injection.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../../../l10n/app_localizations.dart';
class AccountStatementScreen extends StatefulWidget {
final String accountNo;
const AccountStatementScreen({
super.key,
required this.accountNo,
});
const AccountStatementScreen({super.key, required this.accountNo});
@override
State<AccountStatementScreen> createState() => _AccountStatementScreen();
@@ -45,8 +42,10 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'${AppLocalizations.of(context).failedToLoadTransactions} $e')),
content: Text(
'${AppLocalizations.of(context).failedToLoadTransactions} $e',
),
),
);
} finally {
setState(() => _txLoading = false);
@@ -73,7 +72,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
if (fromDate == null) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(AppLocalizations.of(context).pleaseSelectDateFirst)),
content: Text(AppLocalizations.of(context).pleaseSelectDateFirst),
),
);
return;
}
@@ -115,7 +115,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
),
title: Text(
AppLocalizations.of(context).accountStatement,
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
style: const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
),
centerTitle: false,
actions: [
@@ -141,15 +141,21 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
children: [
Row(
children: [
Text("${AppLocalizations.of(context).accountNumber}: ",
style: const TextStyle(
fontSize: 19, fontWeight: FontWeight.bold)),
Text(
"${AppLocalizations.of(context).accountNumber}: ",
style: const TextStyle(
fontSize: 19,
fontWeight: FontWeight.bold,
),
),
Text(widget.accountNo, style: const TextStyle(fontSize: 17)),
],
),
const SizedBox(height: 15),
Text(AppLocalizations.of(context).filters,
style: const TextStyle(fontSize: 17)),
Text(
AppLocalizations.of(context).filters,
style: const TextStyle(fontSize: 17),
),
const SizedBox(height: 15),
Row(
children: [
@@ -157,7 +163,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
child: GestureDetector(
onTap: () => _selectFromDate(context),
child: buildDateBox(
AppLocalizations.of(context).fromDate, fromDate),
AppLocalizations.of(context).fromDate,
fromDate,
),
),
),
const SizedBox(width: 10),
@@ -165,7 +173,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
child: GestureDetector(
onTap: () => _selectToDate(context),
child: buildDateBox(
AppLocalizations.of(context).toDate, toDate),
AppLocalizations.of(context).toDate,
toDate,
),
),
),
],
@@ -178,7 +188,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
controller: _minAmountController,
decoration: InputDecoration(
labelText: AppLocalizations.of(context).minAmount,
border: OutlineInputBorder(),
border: const OutlineInputBorder(),
isDense: true,
filled: true,
fillColor: Colors.white,
@@ -193,7 +203,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
controller: _maxAmountController,
decoration: InputDecoration(
labelText: AppLocalizations.of(context).maxAmount,
border: OutlineInputBorder(),
border: const OutlineInputBorder(),
isDense: true,
filled: true,
fillColor: Colors.white,
@@ -241,19 +251,27 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
baseColor: Colors.grey[300]!,
highlightColor: Colors.grey[100]!,
child: const CircleAvatar(
radius: 12, backgroundColor: Colors.white),
radius: 12,
backgroundColor: Colors.white,
),
),
title: Shimmer.fromColors(
baseColor: Colors.grey[300]!,
highlightColor: Colors.grey[100]!,
child: Container(
height: 10, width: 100, color: Colors.white),
height: 10,
width: 100,
color: Colors.white,
),
),
subtitle: Shimmer.fromColors(
baseColor: Colors.grey[300]!,
highlightColor: Colors.grey[100]!,
child: Container(
height: 8, width: 60, color: Colors.white),
height: 8,
width: 60,
color: Colors.white,
),
),
),
)
@@ -262,44 +280,37 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
child: Text(
AppLocalizations.of(context).noTransactions,
style: TextStyle(
fontSize: 16,
color: Colors.grey[600],
),
fontSize: 16, color: Colors.grey[600]),
),
)
: ListView.builder(
itemCount: _transactions.length,
itemBuilder: (context, index) {
final txn = _transactions[index];
final isCredit = txn.type == 'CR';
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(txn.date ?? '',
style: const TextStyle(color: Colors.grey)),
const SizedBox(height: 4),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(txn.name ?? '',
style: const TextStyle(fontSize: 16)),
),
Text(
"${isCredit ? '+' : '-'}${txn.amount}",
style: TextStyle(
color: isCredit
? Colors.green
: Colors.red,
// fontWeight: FontWeight.bold,
fontSize: 16,
),
),
],
),
const SizedBox(height: 25),
],
final tx = _transactions[index];
return ListTile(
leading: Icon(
tx.type == 'CR'
? Symbols.call_received
: Symbols.call_made,
color:
tx.type == 'CR' ? Colors.green : Colors.red,
),
title: Text(
tx.name != null
? (tx.name!.length > 18
? tx.name!.substring(0, 20)
: tx.name!)
: '',
style: const TextStyle(fontSize: 14),
),
subtitle: Text(
tx.date ?? '',
style: const TextStyle(fontSize: 12),
),
trailing: Text(
"${tx.amount}",
style: const TextStyle(fontSize: 16),
),
);
},
),