formatted some files

This commit is contained in:
asif
2025-08-23 23:51:53 +05:30
parent 5f41c6e7f4
commit 59eb509dda
8 changed files with 125 additions and 116 deletions

View File

@@ -475,4 +475,3 @@ class BiometricPromptScreen extends StatelessWidget {
}
}
}

View File

@@ -14,6 +14,3 @@ class RtgsResponse {
);
}
}

View File

@@ -62,7 +62,7 @@ Dio _createDioClient() {
BaseOptions(
baseUrl:
//'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080',
'http://localhost:8081',
'http://localhost:8081',
connectTimeout: const Duration(seconds: 5),
receiveTimeout: const Duration(seconds: 10),
headers: {

View File

@@ -135,9 +135,9 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
completer.complete(paymentResponse);
}
}
//IMPS transaction
else if (_selectedMode == TransactionMode.imps){
//IMPS transaction
else if (_selectedMode == TransactionMode.imps) {
final impsTx = ImpsTransaction(
fromAccount: widget.debitAccountNo,
toAccount: widget.creditBeneficiary.accountNo,
@@ -169,18 +169,19 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
utr: impsResponse.utr,
);
completer.complete(paymentResponse);
} on DioException catch(e) {
} on DioException catch (e) {
print('dio exception');
print(e.toString());
final error = jsonDecode(e.response.toString())['error'];
var errorMessage =
{
"INCORRECT_TPIN" : "Please Enter the correct TPIN",
"INSUFFICIENT_FUNDS": "Your account does not have sufficient balance"
}[error] ?? "Something Went Wrong";
var errorMessage = {
"INCORRECT_TPIN": "Please Enter the correct TPIN",
"INSUFFICIENT_FUNDS":
"Your account does not have sufficient balance"
}[error] ??
"Something Went Wrong";
final paymentResponse = PaymentResponse(
final paymentResponse = PaymentResponse(
isSuccess: false,
errorMessage: errorMessage,
);
@@ -194,8 +195,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
);
completer.complete(paymentResponse);
}
}
else {
} else {
final rtgsTx = RtgsTransaction(
fromAccount: widget.debitAccountNo,
toAccount: widget.creditBeneficiary.accountNo,
@@ -329,9 +329,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
child: ToggleButtons(
isSelected: [
_selectedMode == TransactionMode.neft,
_selectedMode == TransactionMode.rtgs,
_selectedMode == TransactionMode.rtgs,
_selectedMode == TransactionMode.imps,
],
onPressed: (index) {
setState(() {
@@ -358,8 +357,9 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
horizontal: 24.0, vertical: 12.0),
child: Text(AppLocalizations.of(context).rtgs),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 24.0, vertical: 12.0),
child: Text(AppLocalizations.of(context).imps),
),
],

View File

@@ -188,7 +188,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
toAccount: accountNumberController.text,
amount: amountController.text,
ifscCode: ifscController.text,
remitterName: "Unknown",
remitterName: "Unknown",
beneficiaryName: nameController.text,
tpin: tpin,
);
@@ -221,7 +221,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
);
completer.complete(paymentResponse);
}
}
}
if (isImps) {
// IMPS
@@ -230,7 +230,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
toAccount: accountNumberController.text,
amount: amountController.text,
ifscCode: ifscController.text,
remitterName: "Unknown",
remitterName: "Unknown",
beneficiaryName: nameController.text,
tpin: tpin,
);
@@ -263,16 +263,16 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
);
completer.complete(paymentResponse);
}
}
}
if(isRtgs) {
if (isRtgs) {
// RTGS
final rtgsTx = RtgsTransaction(
fromAccount: widget.debitAccount,
toAccount: accountNumberController.text,
amount: amountController.text,
ifscCode: ifscController.text,
remitterName: "Unknown",
remitterName: "Unknown",
beneficiaryName: nameController.text,
tpin: tpin,
);

View File

@@ -7,50 +7,61 @@ class Branch {
final String ifsc;
final String address;
Branch({required this.name, required this.code, required this.ifsc, required this.address,});
Branch({
required this.name,
required this.code,
required this.ifsc,
required this.address,
});
}
class BranchLocatorScreen extends StatefulWidget {
const BranchLocatorScreen({super.key});
@override
State<BranchLocatorScreen> createState() => _BranchLocatorScreenState();
@override
State<BranchLocatorScreen> createState() => _BranchLocatorScreenState();
}
class _BranchLocatorScreenState extends State<BranchLocatorScreen> {
final TextEditingController _searchController = TextEditingController();
final TextEditingController _searchController = TextEditingController();
// Static list of 5 branches
final List<Branch> _branches = [
Branch(name: "Dharamsala - Head Office", code: "002", ifsc: "KACE0000002", address: "Civil Lines Dharmashala, Kangra, HP - 176215"),
Branch(name: "Kangra", code: "033", ifsc: "KACE0000033", address: "Rajput Bhawankangrapo Kangra, Kangra, HP "),
];
final List<Branch> _branches = [
Branch(
name: "Dharamsala - Head Office",
code: "002",
ifsc: "KACE0000002",
address: "Civil Lines Dharmashala, Kangra, HP - 176215"),
Branch(
name: "Kangra",
code: "033",
ifsc: "KACE0000033",
address: "Rajput Bhawankangrapo Kangra, Kangra, HP "),
];
List<Branch> _filteredBranches = [];
@override
void initState() {
super.initState();
_filteredBranches = _branches; // Initially show all branches
}
void _filterBranches(String query) {
setState(() {
if (query.isEmpty) {
_filteredBranches = _branches;
} else {
_filteredBranches = _branches.where((branch) {
final lowerQuery = query.toLowerCase();
return branch.name.toLowerCase().contains(lowerQuery) ||
branch.code.toLowerCase().contains(lowerQuery) ||
branch.ifsc.toLowerCase().contains(lowerQuery) ||
branch.address.toLowerCase().contains(lowerQuery);
}).toList();
}
});
}
List<Branch> _filteredBranches = [];
@override
void initState() {
super.initState();
_filteredBranches = _branches; // Initially show all branches
}
void _filterBranches(String query) {
setState(() {
if (query.isEmpty) {
_filteredBranches = _branches;
} else {
_filteredBranches = _branches.where((branch) {
final lowerQuery = query.toLowerCase();
return branch.name.toLowerCase().contains(lowerQuery) ||
branch.code.toLowerCase().contains(lowerQuery) ||
branch.ifsc.toLowerCase().contains(lowerQuery) ||
branch.address.toLowerCase().contains(lowerQuery);
}).toList();
}
});
}
// @override
// Widget build(BuildContext context) {
@@ -78,7 +89,7 @@ branch.address.toLowerCase().contains(lowerQuery);
// label: Text( AppLocalizations.of(context).searchbranch),
// onPressed: () {
// // Place API here
// // ScaffoldMessenger.of(context).showSnackBar(
// // SnackBar(content: Text( AppLocalizations.of(context).branchsearchsoon)),
// // );
@@ -91,58 +102,62 @@ branch.address.toLowerCase().contains(lowerQuery);
// }
// }
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context).branchLocator),
),
body: Column(
children: [
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context).branchLocator),
),
body: Column(
children: [
// Search bar
Padding(
padding: const EdgeInsets.all(12.0),
child: TextField(
controller: _searchController,
onChanged: _filterBranches,
decoration: InputDecoration(
hintText: AppLocalizations.of(context).searchbranchby,
prefixIcon: const Icon(Icons.search),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
),
Padding(
padding: const EdgeInsets.all(12.0),
child: TextField(
controller: _searchController,
onChanged: _filterBranches,
decoration: InputDecoration(
hintText: AppLocalizations.of(context).searchbranchby,
prefixIcon: const Icon(Icons.search),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
),
// List of branches
Expanded(
child: _filteredBranches.isEmpty
? const Center(child: Text("No matching branches found"))
: ListView.builder(
itemCount: _filteredBranches.length,
itemBuilder: (context, index) {
final branch = _filteredBranches[index];
return Card(
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
child: ListTile(
leading: Icon(Icons.location_city, color: Theme.of(context).primaryColor),
title: Text(branch.name, style: const TextStyle(fontWeight: FontWeight.bold)),
subtitle: Text("Code: ${branch.code} | IFSC: ${branch.ifsc} \nBranch Address: ${branch.address}"),
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Selected ${branch.name}")),
);
},
),
);
},
),
),
],
),
);
Expanded(
child: _filteredBranches.isEmpty
? const Center(child: Text("No matching branches found"))
: ListView.builder(
itemCount: _filteredBranches.length,
itemBuilder: (context, index) {
final branch = _filteredBranches[index];
return Card(
margin: const EdgeInsets.symmetric(
horizontal: 12, vertical: 6),
child: ListTile(
leading: Icon(Icons.location_city,
color: Theme.of(context).primaryColor),
title: Text(branch.name,
style:
const TextStyle(fontWeight: FontWeight.bold)),
subtitle: Text(
"Code: ${branch.code} | IFSC: ${branch.ifsc} \nBranch Address: ${branch.address}"),
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text("Selected ${branch.name}")),
);
},
),
);
},
),
),
],
),
);
}
}
}

View File

@@ -74,10 +74,9 @@ class _ServiceScreen extends State<ServiceScreen> {
label: AppLocalizations.of(context).branchLocator,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const BranchLocatorScreen())
);
context,
MaterialPageRoute(
builder: (context) => const BranchLocatorScreen()));
},
),
const Divider(height: 1),

View File

@@ -71,8 +71,7 @@ Widget getBankLogo(String? bankName) {
width: 40,
height: 40,
);
}
else {
} else {
return const Icon(
Icons.account_balance,
size: 40,