FAQs link added and Branch and ATM locator updated

This commit is contained in:
2025-09-25 12:56:03 +05:30
parent cc7c7a8042
commit 0e4072fe8f
5 changed files with 192 additions and 117 deletions

View File

@@ -65,9 +65,9 @@ Dio _createDioClient() {
final dio = Dio( final dio = Dio(
BaseOptions( BaseOptions(
baseUrl: baseUrl:
//'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080', //test 'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080', //test
//'http://lb-kccb-mobile-banking-app-848675342.ap-south-1.elb.amazonaws.com', //prod //'http://lb-kccb-mobile-banking-app-848675342.ap-south-1.elb.amazonaws.com', //prod
'https://kccbmbnk.net', //'https://kccbmbnk.net',
connectTimeout: const Duration(seconds: 60), connectTimeout: const Duration(seconds: 60),
receiveTimeout: const Duration(seconds: 60), receiveTimeout: const Duration(seconds: 60),
headers: { headers: {

View File

@@ -1,17 +1,22 @@
import '../../../l10n/app_localizations.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../l10n/app_localizations.dart';
class Branch { // Enum to define the type of location
enum LocationType { branch, atm }
class Location {
final String name; final String name;
final String code; final String? code; // Nullable for ATMs
final String ifsc; final String? ifsc; // Nullable for ATMs
final String address; final String address;
final LocationType type;
Branch({ Location({
required this.name, required this.name,
required this.code, this.code,
required this.ifsc, this.ifsc,
required this.address, required this.address,
required this.type,
}); });
} }
@@ -22,103 +27,160 @@ class BranchLocatorScreen extends StatefulWidget {
State<BranchLocatorScreen> createState() => _BranchLocatorScreenState(); State<BranchLocatorScreen> createState() => _BranchLocatorScreenState();
} }
class _BranchLocatorScreenState extends State<BranchLocatorScreen> { class _BranchLocatorScreenState extends State<BranchLocatorScreen> {
final TextEditingController _searchController = TextEditingController(); final TextEditingController _searchController = TextEditingController();
// Static list of 2 branches final List<Location> _allLocations = [
final List<Branch> _branches = [ Location(
Branch( name: "Dharamsala - Head Office",
name: "Dharamsala - Head Office", code: "002",
code: "002", ifsc: "KACE0000002",
ifsc: "KACE0000002", address: "Civil Lines Dharmashala, Kangra, HP - 176215",
address: "Civil Lines Dharmashala, Kangra, HP - 176215"), type: LocationType.branch,
Branch( ),
name: "Kangra", Location(
code: "033", name: "Kangra",
ifsc: "KACE0000033", code: "033",
address: "Rajput Bhawankangrapo, Kangra, HP "), ifsc: "KACE0000033",
]; address: "Rajput Bhawankangrapo, Kangra, HP ",
type: LocationType.branch,
),
Location(
name: "Dharamsala ATM",
address: "Near Main Square, Dharamsala",
type: LocationType.atm,
),
Location(
name: "Kangra ATM",
address: "Opposite Bus Stand, Kangra",
type: LocationType.atm,
),
];
List<Branch> _filteredBranches = []; List<Location> _filteredLocations = [];
bool _isLoading = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_filteredBranches = _branches; // Initially show all branches // _fetchAndSetLocations();
} _filteredLocations = _allLocations;
}
void _filterBranches(String query) { // Example of a future API fetching function
/*
Future<void> _fetchAndSetLocations() async {
setState(() {
_isLoading = true;
});
try {
// final locations = await yourApiService.getLocations();
// setState(() {
// _allLocations = locations;
// _filteredLocations = locations;
// });
} catch (e) {
// Handle error
} finally {
setState(() { setState(() {
if (query.isEmpty) { _isLoading = false;
_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) {
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),
),
),
),
),
// 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).colorScheme.primary),
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}")),
);
},
),
);
},
),
),
],
),
);
}
} }
*/
void _filterLocations(String query) {
setState(() {
if (query.isEmpty) {
_filteredLocations = _allLocations;
} else {
_filteredLocations = _allLocations.where((location) {
final lowerQuery = query.toLowerCase();
return location.name.toLowerCase().contains(lowerQuery) ||
(location.code?.toLowerCase().contains(lowerQuery) ?? false) ||
(location.ifsc?.toLowerCase().contains(lowerQuery) ?? false) ||
location.address.toLowerCase().contains(lowerQuery);
}).toList();
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context).branchLocator),
),
body: Column(
children: [
Padding(
padding: const EdgeInsets.all(12.0),
child: TextField(
controller: _searchController,
onChanged: _filterLocations,
decoration: InputDecoration(
hintText: AppLocalizations.of(context).searchbranchby,
prefixIcon: const Icon(Icons.search),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
),
// Content area
Expanded(
child: _isLoading
? const Center(child: CircularProgressIndicator())
: _filteredLocations.isEmpty
? const Center(child: Text("No matching locations found"))
: ListView.builder(
itemCount: _filteredLocations.length,
itemBuilder: (context, index) {
final location = _filteredLocations[index];
return _buildLocationItem(location);
},
),
),
],
),
);
}
Widget _buildHeader(String title) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
child: Text(
title,
style: Theme.of(context).textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary,
),
),
);
}
// Helper widget to build a single location item
Widget _buildLocationItem(Location location) {
final isBranch = location.type == LocationType.branch;
return Card(
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
child: ListTile(
leading: CircleAvatar(
child: Icon(isBranch ? Icons.location_city : Icons.currency_rupee),
),
title: Text(location.name,
style: const TextStyle(fontWeight: FontWeight.bold)),
subtitle: Text(
isBranch
? "Code: ${location.code} | IFSC: ${location.ifsc}\nAddress: ${location.address}"
: "Address: ${location.address}",
),
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Selected ${location.name}")),
);
},
),
);
}
}

View File

@@ -29,23 +29,30 @@ Widget build(BuildContext context) {
icon: Symbols.add, icon: Symbols.add,
label: AppLocalizations.of(context).accountOpeningDeposit, label: AppLocalizations.of(context).accountOpeningDeposit,
onTap: () {}, onTap: () {},
disabled: true, // Add this disabled: true,
), ),
const Divider(height: 1), const Divider(height: 1),
ServiceManagementTile( ServiceManagementTile(
icon: Symbols.add, icon: Symbols.add,
label: AppLocalizations.of(context).accountOpeningLoan, label: AppLocalizations.of(context).accountOpeningLoan,
onTap: () {}, onTap: () {},
disabled: true, // Add this disabled: true,
), ),
const Divider(height: 1), const Divider(height: 1),
ServiceManagementTile( ServiceManagementTile(
icon: Symbols.captive_portal, icon: Symbols.captive_portal,
label: AppLocalizations.of(context).quickLinks, label: AppLocalizations.of(context).quickLinks,
onTap: () {}, onTap: () {},
disabled: true, // Add this disabled: true,
), ),
const Divider(height: 1), const Divider(height: 1),
ServiceManagementTile(
icon: Symbols.question_mark,
label: AppLocalizations.of(context).faq,
onTap: () {},
disabled: true,
),
const Divider(height: 1),
ServiceManagementTile( ServiceManagementTile(
icon: Symbols.missing_controller, icon: Symbols.missing_controller,
label: AppLocalizations.of(context).branchLocator, label: AppLocalizations.of(context).branchLocator,
@@ -55,7 +62,7 @@ Widget build(BuildContext context) {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => const BranchLocatorScreen())); builder: (context) => const BranchLocatorScreen()));
}, },
disabled: true, // Add this disabled: false,
), ),
const Divider(height: 1), const Divider(height: 1),
], ],
@@ -68,14 +75,14 @@ class ServiceManagementTile extends StatelessWidget {
final IconData icon; final IconData icon;
final String label; final String label;
final VoidCallback onTap; final VoidCallback onTap;
final bool disabled; // Add this line final bool disabled;
const ServiceManagementTile({ const ServiceManagementTile({
super.key, super.key,
required this.icon, required this.icon,
required this.label, required this.label,
required this.onTap, required this.onTap,
this.disabled = false, // Add this line this.disabled = false,
}); });
@override @override
@@ -84,20 +91,20 @@ class ServiceManagementTile extends StatelessWidget {
return ListTile( return ListTile(
leading: Icon( leading: Icon(
icon, icon,
color: disabled ? theme.disabledColor : null, // Change color when disabled color: disabled ? theme.disabledColor : null,
), ),
title: Text( title: Text(
label, label,
style: TextStyle( style: TextStyle(
color: disabled ? theme.disabledColor : null, // Change color when disabled color: disabled ? theme.disabledColor : null,
), ),
), ),
trailing: Icon( trailing: Icon(
Symbols.arrow_right, Symbols.arrow_right,
size: 20, size: 20,
color: disabled ? theme.disabledColor : null, // Change color when disabled color: disabled ? theme.disabledColor : null,
), ),
onTap: disabled ? null : onTap, // Disable onTap when disabled onTap: disabled ? null : onTap,
); );
} }
} }

View File

@@ -98,7 +98,7 @@
"accountOpeningDeposit": "Account Opening Request - Deposit", "accountOpeningDeposit": "Account Opening Request - Deposit",
"accountOpeningLoan": "Account Opening Request - Loan", "accountOpeningLoan": "Account Opening Request - Loan",
"quickLinks": "Quick Links", "quickLinks": "Quick Links",
"branchLocator": "Branch Locator", "branchLocator": "Branch and ATM Locator",
"emailLaunchError": "Could not launch email client for", "emailLaunchError": "Could not launch email client for",
"dialerLaunchError": "Could not launch dialer for", "dialerLaunchError": "Could not launch dialer for",
"writeToUs": "Write to us", "writeToUs": "Write to us",
@@ -248,7 +248,7 @@
"validateBeneficiaryproceeding": "Please validate beneficiary before proceeding", "validateBeneficiaryproceeding": "Please validate beneficiary before proceeding",
"findnearbybranched": "Find nearby branches", "findnearbybranched": "Find nearby branches",
"searchbranch": "Search Branch", "searchbranch": "Search Branch",
"searchbranchby": "Search by Branch Name / Code / IFSC", "searchbranchby": "Name / Code / IFSC / Address",
"branchsearchsoon": "Branch search coming soon...", "branchsearchsoon": "Branch search coming soon...",
"loginFailed": "Login failed", "loginFailed": "Login failed",
"invalidCredentials": "Invalid credentials", "invalidCredentials": "Invalid credentials",
@@ -315,5 +315,8 @@
"themeModeDark": "Dark", "themeModeDark": "Dark",
"details": "Details", "details": "Details",
"remarks": "Remarks (Optional)", "remarks": "Remarks (Optional)",
"kccbMobile": "KCCB Mobile" "kccbMobile": "KCCB Mobile",
"faq": "Frequently Asked Questions(FAQs)",
"branches": "Branches",
"atms": "ATMs"
} }

View File

@@ -98,7 +98,7 @@
"accountOpeningDeposit": "खाता खोलने का अनुरोध - जमा", "accountOpeningDeposit": "खाता खोलने का अनुरोध - जमा",
"accountOpeningLoan": "खाता खोलने का अनुरोध - ऋण", "accountOpeningLoan": "खाता खोलने का अनुरोध - ऋण",
"quickLinks": "त्वरित लिंक", "quickLinks": "त्वरित लिंक",
"branchLocator": "शाखा लोकेटर", "branchLocator": "शाखा और एटीएम लोकेटर",
"emailLaunchError": "ईमेल क्लाइंट खोलने में विफल: ", "emailLaunchError": "ईमेल क्लाइंट खोलने में विफल: ",
"dialerLaunchError": "डायलर खोलने में विफल: ", "dialerLaunchError": "डायलर खोलने में विफल: ",
"writeToUs": "हमें लिखें", "writeToUs": "हमें लिखें",
@@ -249,7 +249,7 @@
"validateBeneficiaryproceeding": "कृपया आगे बढ़ने से पहले लाभार्थी को पट्टे पर मान्य करें", "validateBeneficiaryproceeding": "कृपया आगे बढ़ने से पहले लाभार्थी को पट्टे पर मान्य करें",
"findnearbybranched": "आस-पास की शाखाएँ खोजें", "findnearbybranched": "आस-पास की शाखाएँ खोजें",
"searchbranch": "शाखा खोजें", "searchbranch": "शाखा खोजें",
"searchbranchby": "शाखा खोजें नाम / बैंक कोड / आईएफएससी द्वारा", "searchbranchby": "शाखा नाम / बैंक कोड / आईएफएससी / पता",
"branchsearchsoon": "शाखा खोज सुविधा जल्द ही आ रही है...", "branchsearchsoon": "शाखा खोज सुविधा जल्द ही आ रही है...",
"loginFailed": "लॉगिन विफल", "loginFailed": "लॉगिन विफल",
"invalidCredentials": "अवैध प्रत्यय पत्र", "invalidCredentials": "अवैध प्रत्यय पत्र",
@@ -316,5 +316,8 @@
"themeModeDark": "डार्क", "themeModeDark": "डार्क",
"details": "विवरण", "details": "विवरण",
"remarks": "विचार (अनिवार्य नहीं)", "remarks": "विचार (अनिवार्य नहीं)",
"kccbMobile": "केसीसीबी मोबाइल" "kccbMobile": "केसीसीबी मोबाइल",
"faq": "अक्सर पूछे जाने वाले प्रश्न",
"branches": "शाखाओं",
"atms": "एटीएम"
} }