Code Formatted
This commit is contained in:
@@ -1,47 +1,47 @@
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class Branch{
|
||||
final String branch_code;
|
||||
final String branch_name;
|
||||
final String zone;
|
||||
final String tehsil;
|
||||
final String block;
|
||||
final String block_code;
|
||||
final String distt_name;
|
||||
final String distt_code_slbc;
|
||||
final String date_of_opening;
|
||||
final String rbi_code_1;
|
||||
final String rbi_code_2;
|
||||
final String telephone_no;
|
||||
final String type_of_branch;
|
||||
final String rtgs_acct_no;
|
||||
final String br_lattitude;
|
||||
final String br_longitude;
|
||||
final String pincode;
|
||||
final String post_office;
|
||||
class Branch {
|
||||
final String branch_code;
|
||||
final String branch_name;
|
||||
final String zone;
|
||||
final String tehsil;
|
||||
final String block;
|
||||
final String block_code;
|
||||
final String distt_name;
|
||||
final String distt_code_slbc;
|
||||
final String date_of_opening;
|
||||
final String rbi_code_1;
|
||||
final String rbi_code_2;
|
||||
final String telephone_no;
|
||||
final String type_of_branch;
|
||||
final String rtgs_acct_no;
|
||||
final String br_lattitude;
|
||||
final String br_longitude;
|
||||
final String pincode;
|
||||
final String post_office;
|
||||
|
||||
Branch({
|
||||
required this.branch_code,
|
||||
required this.branch_name,
|
||||
required this.zone,
|
||||
required this.tehsil,
|
||||
required this.block,
|
||||
required this.block_code,
|
||||
required this.distt_name,
|
||||
required this.distt_code_slbc,
|
||||
required this.date_of_opening,
|
||||
required this.rbi_code_1,
|
||||
required this.rbi_code_2,
|
||||
required this.telephone_no,
|
||||
required this.type_of_branch,
|
||||
required this.rtgs_acct_no,
|
||||
required this.br_lattitude,
|
||||
required this.br_longitude,
|
||||
required this.pincode,
|
||||
required this.post_office,
|
||||
});
|
||||
Branch({
|
||||
required this.branch_code,
|
||||
required this.branch_name,
|
||||
required this.zone,
|
||||
required this.tehsil,
|
||||
required this.block,
|
||||
required this.block_code,
|
||||
required this.distt_name,
|
||||
required this.distt_code_slbc,
|
||||
required this.date_of_opening,
|
||||
required this.rbi_code_1,
|
||||
required this.rbi_code_2,
|
||||
required this.telephone_no,
|
||||
required this.type_of_branch,
|
||||
required this.rtgs_acct_no,
|
||||
required this.br_lattitude,
|
||||
required this.br_longitude,
|
||||
required this.pincode,
|
||||
required this.post_office,
|
||||
});
|
||||
|
||||
factory Branch.fromJson(Map<String, dynamic> json) {
|
||||
factory Branch.fromJson(Map<String, dynamic> json) {
|
||||
return Branch(
|
||||
branch_code: json['branch_code'] ?? json['branch_code'] ?? '',
|
||||
branch_name: json['branch_name'] ?? json['branch_name'] ?? '',
|
||||
@@ -64,15 +64,14 @@ factory Branch.fromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
static List<Branch> listFromJson(List<dynamic> jsonList) {
|
||||
final beneficiaryList = jsonList
|
||||
.map((beneficiary) => Branch.fromJson(beneficiary))
|
||||
.toList();
|
||||
static List<Branch> listFromJson(List<dynamic> jsonList) {
|
||||
final beneficiaryList =
|
||||
jsonList.map((beneficiary) => Branch.fromJson(beneficiary)).toList();
|
||||
return beneficiaryList;
|
||||
}
|
||||
}
|
||||
|
||||
class Atm {
|
||||
class Atm {
|
||||
final String name;
|
||||
|
||||
Atm({required this.name});
|
||||
@@ -86,7 +85,7 @@ static List<Branch> listFromJson(List<dynamic> jsonList) {
|
||||
static List<Atm> listFromJson(List<dynamic> jsonList) {
|
||||
return jsonList.map((atm) => Atm.fromJson(atm)).toList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class BranchService {
|
||||
final Dio _dio;
|
||||
|
||||
@@ -101,7 +101,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
? fromDate!.add(const Duration(days: 183))
|
||||
: now;
|
||||
final initialToDate = toDate ?? now;
|
||||
final clampedInitialToDate = initialToDate.isBefore(fromDate!) ? fromDate! : initialToDate;
|
||||
final clampedInitialToDate =
|
||||
initialToDate.isBefore(fromDate!) ? fromDate! : initialToDate;
|
||||
final picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: clampedInitialToDate,
|
||||
@@ -238,8 +239,11 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
itemCount: 3,
|
||||
itemBuilder: (_, __) => ListTile(
|
||||
leading: Shimmer.fromColors(
|
||||
baseColor: Theme.of(context).colorScheme.surfaceVariant,
|
||||
highlightColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
baseColor:
|
||||
Theme.of(context).colorScheme.surfaceVariant,
|
||||
highlightColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
child: CircleAvatar(
|
||||
radius: 12,
|
||||
backgroundColor:
|
||||
@@ -247,8 +251,11 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
),
|
||||
),
|
||||
title: Shimmer.fromColors(
|
||||
baseColor: Theme.of(context).colorScheme.surfaceVariant,
|
||||
highlightColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
baseColor:
|
||||
Theme.of(context).colorScheme.surfaceVariant,
|
||||
highlightColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
child: Container(
|
||||
height: 10,
|
||||
width: 100,
|
||||
@@ -257,8 +264,11 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
),
|
||||
),
|
||||
subtitle: Shimmer.fromColors(
|
||||
baseColor: Theme.of(context).colorScheme.surfaceVariant,
|
||||
highlightColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
baseColor:
|
||||
Theme.of(context).colorScheme.surfaceVariant,
|
||||
highlightColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
child: Container(
|
||||
height: 8,
|
||||
width: 60,
|
||||
@@ -288,7 +298,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
? Symbols.call_received
|
||||
: Symbols.call_made,
|
||||
color: tx.type == 'CR'
|
||||
? Theme.of(context).colorScheme.secondary
|
||||
? Theme.of(context)
|
||||
.colorScheme
|
||||
.secondary
|
||||
: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
@@ -332,7 +344,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) {
|
||||
return Divider(color: Theme.of(context).dividerColor);
|
||||
return Divider(
|
||||
color: Theme.of(context).dividerColor);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -46,7 +46,8 @@ class _AllAccountsScreenState extends State<AllAccountsScreen> {
|
||||
itemBuilder: (context, index) {
|
||||
final user = widget.users[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||
child: _buildAccountCard(user),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -22,7 +22,9 @@ class BeneficiaryDetailsScreen extends StatelessWidget {
|
||||
_showSuccessDialog(context);
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('${AppLocalizations.of(context).failedToDeleteBeneficiary} : $e')),
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'${AppLocalizations.of(context).failedToDeleteBeneficiary} : $e')),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +35,8 @@ class BeneficiaryDetailsScreen extends StatelessWidget {
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(AppLocalizations.of(context).success),
|
||||
content: Text(AppLocalizations.of(context).beneficiaryDeletedSuccessfully),
|
||||
content:
|
||||
Text(AppLocalizations.of(context).beneficiaryDeletedSuccessfully),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text(AppLocalizations.of(context).ok),
|
||||
@@ -53,8 +56,8 @@ class BeneficiaryDetailsScreen extends StatelessWidget {
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(AppLocalizations.of(context).deleteBeneficiary),
|
||||
content:
|
||||
Text(AppLocalizations.of(context).areYouSureYouWantToDeleteThisBeneficiary),
|
||||
content: Text(AppLocalizations.of(context)
|
||||
.areYouSureYouWantToDeleteThisBeneficiary),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text(AppLocalizations.of(context).cancel),
|
||||
|
||||
@@ -17,8 +17,9 @@ class _ChequeManagementScreen extends State<ChequeManagementScreen> {
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
AppLocalizations.of(context).chequeManagement,
|
||||
style:
|
||||
TextStyle(color: Theme.of(context).textTheme.titleLarge?.color, fontWeight: FontWeight.w500),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).textTheme.titleLarge?.color,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
centerTitle: false,
|
||||
),
|
||||
|
||||
@@ -222,7 +222,8 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
if (isSelected) // Only show toggle for selected card
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
if (isRefreshing) return; // Prevent taps while refreshing
|
||||
if (isRefreshing)
|
||||
return; // Prevent taps while refreshing
|
||||
final accountNo = user.accountNo;
|
||||
if (accountNo == null) return;
|
||||
|
||||
@@ -325,8 +326,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
return Shimmer.fromColors(
|
||||
baseColor: theme.colorScheme.primary,
|
||||
highlightColor: theme.colorScheme.onPrimary,
|
||||
child: Container(
|
||||
height: 36, color: theme.scaffoldBackgroundColor),
|
||||
child: Container(height: 36, color: theme.scaffoldBackgroundColor),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
onTap: () {
|
||||
final authState = context.read<AuthCubit>().state;
|
||||
String mobileNumberToPass = '';
|
||||
String customerNo ='';
|
||||
String customerNo = '';
|
||||
String customerName = '';
|
||||
if (authState is Authenticated) {
|
||||
if (selectedAccountIndex >= 0 &&
|
||||
@@ -454,7 +454,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
authState.users[selectedAccountIndex].mobileNo ?? '';
|
||||
customerNo =
|
||||
authState.users[selectedAccountIndex].cifNumber ?? '';
|
||||
customerName=
|
||||
customerName =
|
||||
authState.users[selectedAccountIndex].name ?? '';
|
||||
}
|
||||
}
|
||||
@@ -462,8 +462,10 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
ProfileScreen(mobileNumber: mobileNumberToPass, customerNo: customerNo, customerName: customerName),
|
||||
builder: (context) => ProfileScreen(
|
||||
mobileNumber: mobileNumberToPass,
|
||||
customerNo: customerNo,
|
||||
customerName: customerName),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -535,25 +537,31 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
|
||||
// Account Info Cards
|
||||
ClipRect(
|
||||
child: SizedBox( // This SizedBox defines the height for the Stack
|
||||
child: SizedBox(
|
||||
// This SizedBox defines the height for the Stack
|
||||
height: 160,
|
||||
child: Stack(
|
||||
children: [
|
||||
// PageView part, painted underneath
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 48.0), // Space for tab (40) + gap (8)
|
||||
child: SizedBox( // Keep SizedBox for PageView height
|
||||
padding: const EdgeInsets.only(
|
||||
left: 48.0), // Space for tab (40) + gap (8)
|
||||
child: SizedBox(
|
||||
// Keep SizedBox for PageView height
|
||||
height: 160,
|
||||
child: PageView.builder(
|
||||
controller: _pageController,
|
||||
itemCount: users.length,
|
||||
clipBehavior: Clip.none, // Keep this to show adjacent cards
|
||||
clipBehavior: Clip
|
||||
.none, // Keep this to show adjacent cards
|
||||
padEnds: false,
|
||||
onPageChanged: (int newIndex) async {
|
||||
if (newIndex == selectedAccountIndex) return;
|
||||
if (newIndex == selectedAccountIndex)
|
||||
return;
|
||||
|
||||
// Hide the balance of the old card when scrolling away
|
||||
final oldAccountNo = users[selectedAccountIndex].accountNo;
|
||||
final oldAccountNo =
|
||||
users[selectedAccountIndex].accountNo;
|
||||
if (oldAccountNo != null) {
|
||||
_visibilityMap[oldAccountNo] = false;
|
||||
}
|
||||
@@ -568,8 +576,10 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
final user = users[index];
|
||||
final isSelected = index == selectedAccountIndex;
|
||||
return _buildAccountCard(user, isSelected);
|
||||
final isSelected =
|
||||
index == selectedAccountIndex;
|
||||
return _buildAccountCard(
|
||||
user, isSelected);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -715,7 +725,6 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -777,9 +786,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
Icon(
|
||||
icon,
|
||||
size: 30,
|
||||
color: disable
|
||||
? theme.disabledColor
|
||||
: theme.colorScheme.primary,
|
||||
color: disable ? theme.disabledColor : theme.colorScheme.primary,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
@@ -788,9 +795,8 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
color: disable
|
||||
? theme.disabledColor
|
||||
: theme.colorScheme.onSurface,
|
||||
color:
|
||||
disable ? theme.disabledColor : theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -799,4 +805,3 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,10 @@ class _EnquiryScreen extends State<EnquiryScreen> {
|
||||
GestureDetector(
|
||||
onTap: () => _launchPhoneNumber(phone),
|
||||
child: Text(phone,
|
||||
style:
|
||||
TextStyle(color: Theme.of(context).colorScheme.primary)), // Changed color for visibility
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary)), // Changed color for visibility
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -91,14 +93,16 @@ class _EnquiryScreen extends State<EnquiryScreen> {
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
GestureDetector(
|
||||
onTap: () => _launchUrl("https://kccbhp.bank.in/complaint-form/"),
|
||||
onTap: () =>
|
||||
_launchUrl("https://kccbhp.bank.in/complaint-form/"),
|
||||
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
Text(
|
||||
"Complaint Form",
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
decoration: TextDecoration.underline, // Added underline for link clarity
|
||||
decoration: TextDecoration
|
||||
.underline, // Added underline for link clarity
|
||||
decorationColor:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
|
||||
@@ -492,7 +492,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
if (_isLoadingLimit) Text(AppLocalizations.of(context).fetchingDailyLimit),
|
||||
if (_isLoadingLimit)
|
||||
Text(AppLocalizations.of(context).fetchingDailyLimit),
|
||||
if (!_isLoadingLimit && _limit != null)
|
||||
Text(
|
||||
'Remaining Daily Limit: ${_formatCurrency.format(_limit!.dailyLimit - _limit!.usedLimit)}',
|
||||
|
||||
@@ -148,7 +148,8 @@ class FundTransferManagementTile extends StatelessWidget {
|
||||
),
|
||||
elevation: 4, // Add some elevation for better visual separation
|
||||
child: InkWell(
|
||||
onTap: disable ? null : onTap, // Disable InkWell if the tile is disabled
|
||||
onTap:
|
||||
disable ? null : onTap, // Disable InkWell if the tile is disabled
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 16.0),
|
||||
|
||||
@@ -17,7 +17,11 @@ class ProfileScreen extends StatefulWidget {
|
||||
final String mobileNumber;
|
||||
final String customerNo;
|
||||
final String customerName;
|
||||
const ProfileScreen({super.key, required this.mobileNumber, required this.customerNo, required this.customerName});
|
||||
const ProfileScreen(
|
||||
{super.key,
|
||||
required this.mobileNumber,
|
||||
required this.customerNo,
|
||||
required this.customerName});
|
||||
|
||||
@override
|
||||
State<ProfileScreen> createState() => _ProfileScreenState();
|
||||
@@ -306,7 +310,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
// );
|
||||
// }
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
final theme = Theme.of(context);
|
||||
final isDarkMode = theme.brightness == Brightness.dark;
|
||||
@@ -357,8 +361,8 @@ Widget build(BuildContext context) {
|
||||
Text(
|
||||
widget.customerNo,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color:
|
||||
theme.colorScheme.onSurface.withOpacity(0.7),
|
||||
color: theme.colorScheme.onSurface
|
||||
.withOpacity(0.7),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -582,7 +586,7 @@ Widget build(BuildContext context) {
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class _SectionTile extends StatelessWidget {
|
||||
@@ -611,8 +615,7 @@ class _SectionTile extends StatelessWidget {
|
||||
? Icon(Icons.chevron_right, color: theme.colorScheme.onSurface)
|
||||
: null,
|
||||
onTap: onTap,
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
|
||||
@@ -57,7 +57,8 @@ class SecuritySettingsScreen extends StatelessWidget {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(loc.mpinChangedSuccessfully),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,8 @@ class QuickPayManagementTile extends StatelessWidget {
|
||||
),
|
||||
elevation: 4, // Add some elevation for better visual separation
|
||||
child: InkWell(
|
||||
onTap: disable ? null : onTap, // Disable InkWell if the tile is disabled
|
||||
onTap:
|
||||
disable ? null : onTap, // Disable InkWell if the tile is disabled
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 36.0, horizontal: 16.0),
|
||||
|
||||
@@ -15,10 +15,12 @@ class ATMLocatorScreen extends StatefulWidget {
|
||||
|
||||
class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
var service = getIt<BranchService>(); // Added: Instance of BranchService for API calls
|
||||
var service =
|
||||
getIt<BranchService>(); // Added: Instance of BranchService for API calls
|
||||
bool _isLoading = true; // State variable to manage loading status
|
||||
List<Atm> _allAtms = []; // Changed: List to hold all fetched Atm objects
|
||||
List<Atm> _filteredAtms = []; // Changed: List to hold filtered Atm objects for display
|
||||
List<Atm> _filteredAtms =
|
||||
[]; // Changed: List to hold filtered Atm objects for display
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -28,7 +30,8 @@ class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
|
||||
|
||||
/// Fetches the list of ATMs from the API using BranchService.
|
||||
Future<void> _loadAtms() async {
|
||||
final data = await service.fetchAtmList(); // Call the new fetchAtmList method
|
||||
final data =
|
||||
await service.fetchAtmList(); // Call the new fetchAtmList method
|
||||
setState(() {
|
||||
_allAtms = data; // Update the list of all ATMs
|
||||
_filteredAtms = data; // Initialize filtered list with all ATMs
|
||||
@@ -37,14 +40,18 @@ class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
|
||||
}
|
||||
|
||||
/// Filters the list of ATMs based on the search query.
|
||||
void _filterAtms(String query) { // Changed: Renamed from _filterLocations
|
||||
void _filterAtms(String query) {
|
||||
// Changed: Renamed from _filterLocations
|
||||
setState(() {
|
||||
if (query.isEmpty) {
|
||||
_filteredAtms = _allAtms; // If query is empty, show all ATMs
|
||||
} else {
|
||||
_filteredAtms = _allAtms.where((atm) { // Changed: Filter based on Atm object
|
||||
_filteredAtms = _allAtms.where((atm) {
|
||||
// Changed: Filter based on Atm object
|
||||
final lowerQuery = query.toLowerCase();
|
||||
return atm.name.toLowerCase().contains(lowerQuery); // Filter by atm.name
|
||||
return atm.name
|
||||
.toLowerCase()
|
||||
.contains(lowerQuery); // Filter by atm.name
|
||||
}).toList();
|
||||
}
|
||||
});
|
||||
@@ -64,7 +71,8 @@ class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
onChanged: _filterAtms, // Updated: Call _filterAtms on text change
|
||||
onChanged:
|
||||
_filterAtms, // Updated: Call _filterAtms on text change
|
||||
decoration: InputDecoration(
|
||||
hintText: "Name/Address", // Hint text for the search bar
|
||||
prefixIcon: const Icon(Icons.search), // Search icon
|
||||
@@ -81,12 +89,16 @@ class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
|
||||
? _buildShimmerList() // Display shimmer while loading
|
||||
: _filteredAtms.isEmpty
|
||||
? const Center(
|
||||
child: Text("No matching ATMs found")) // Message if no ATMs found
|
||||
child: Text(
|
||||
"No matching ATMs found")) // Message if no ATMs found
|
||||
: ListView.builder(
|
||||
itemCount: _filteredAtms.length, // Number of items in the filtered list
|
||||
itemCount: _filteredAtms
|
||||
.length, // Number of items in the filtered list
|
||||
itemBuilder: (context, index) {
|
||||
final atm = _filteredAtms[index]; // Get the current Atm object
|
||||
return _buildAtmItem(atm); // Build the ATM list item
|
||||
final atm = _filteredAtms[
|
||||
index]; // Get the current Atm object
|
||||
return _buildAtmItem(
|
||||
atm); // Build the ATM list item
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -111,9 +123,9 @@ class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/// Helper widget to build a single ATM list item.
|
||||
Widget _buildAtmItem(Atm atm) { // Changed: Takes an Atm object
|
||||
Widget _buildAtmItem(Atm atm) {
|
||||
// Changed: Takes an Atm object
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
child: ListTile(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kmobile/api/services/branch_service.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kmobile/api/services/branch_service.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class BranchDetailsScreen extends StatelessWidget {
|
||||
class BranchDetailsScreen extends StatelessWidget {
|
||||
final Branch branch;
|
||||
|
||||
const BranchDetailsScreen({super.key, required this.branch});
|
||||
@@ -81,7 +81,8 @@
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: theme.colorScheme.primary, // Indicate it's clickable
|
||||
color:
|
||||
theme.colorScheme.primary, // Indicate it's clickable
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
@@ -98,10 +99,11 @@
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _launchUrl(String urlString) async {
|
||||
final Uri url = Uri.parse(urlString);
|
||||
if (!await launchUrl(url)) {
|
||||
throw 'Could not launch $urlString';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:kmobile/di/injection.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import 'package:kmobile/features/service/screens/branch_details_screen.dart';
|
||||
|
||||
|
||||
class BranchLocatorScreen extends StatefulWidget {
|
||||
const BranchLocatorScreen({super.key});
|
||||
|
||||
@@ -15,7 +14,7 @@ class BranchLocatorScreen extends StatefulWidget {
|
||||
State<BranchLocatorScreen> createState() => _BranchLocatorScreenState();
|
||||
}
|
||||
|
||||
class _BranchLocatorScreenState extends State<BranchLocatorScreen> {
|
||||
class _BranchLocatorScreenState extends State<BranchLocatorScreen> {
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
var service = getIt<BranchService>();
|
||||
bool _isLoading = true;
|
||||
@@ -51,7 +50,6 @@ class BranchLocatorScreen extends StatefulWidget {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -88,11 +86,13 @@ class BranchLocatorScreen extends StatefulWidget {
|
||||
? _buildShimmerList() // Changed to shimmer
|
||||
: _filteredBranches.isEmpty
|
||||
? const Center(
|
||||
child: Text("No matching branches found")) // Updated tex
|
||||
child: Text(
|
||||
"No matching branches found")) // Updated tex
|
||||
: ListView.builder(
|
||||
itemCount: _filteredBranches.length,
|
||||
itemBuilder: (context, index) {
|
||||
final branch = _filteredBranches[index]; // Changed to
|
||||
final branch =
|
||||
_filteredBranches[index]; // Changed to
|
||||
return _buildBranchItem(branch); // Updated
|
||||
},
|
||||
),
|
||||
@@ -155,7 +155,6 @@ class BranchLocatorScreen extends StatefulWidget {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Shimmer loading list
|
||||
Widget _buildShimmerList() {
|
||||
return ListView.builder(
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
//
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kmobile/l10n/app_localizations.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kmobile/l10n/app_localizations.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
// Data model for a single Quick Link item
|
||||
class QuickLink {
|
||||
// Data model for a single Quick Link item
|
||||
class QuickLink {
|
||||
final String title;
|
||||
final String url;
|
||||
// The icon is no longer used in the UI but is kept in the model for potential future use.
|
||||
final IconData icon;
|
||||
|
||||
QuickLink({required this.title, required this.url, required this.icon});
|
||||
}
|
||||
}
|
||||
|
||||
class QuickLinksScreen extends StatefulWidget {
|
||||
class QuickLinksScreen extends StatefulWidget {
|
||||
const QuickLinksScreen({super.key});
|
||||
|
||||
@override
|
||||
State<QuickLinksScreen> createState() => _QuickLinksScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _QuickLinksScreenState extends State<QuickLinksScreen> {
|
||||
class _QuickLinksScreenState extends State<QuickLinksScreen> {
|
||||
// List of Quick Links
|
||||
final List<QuickLink> _quickLinks = [
|
||||
QuickLink(
|
||||
@@ -110,4 +110,4 @@
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ class _ServiceScreen extends State<ServiceScreen> {
|
||||
label: AppLocalizations.of(context).faq,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => const FaqsScreen()),
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const FaqsScreen()),
|
||||
);
|
||||
},
|
||||
disabled: false,
|
||||
@@ -120,7 +121,8 @@ class ServiceManagementTile extends StatelessWidget {
|
||||
),
|
||||
elevation: 4, // Add some elevation for better visual separation
|
||||
child: InkWell(
|
||||
onTap: disabled ? null : onTap, // Disable InkWell if the tile is disabled
|
||||
onTap:
|
||||
disabled ? null : onTap, // Disable InkWell if the tile is disabled
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 16.0),
|
||||
@@ -130,7 +132,8 @@ class ServiceManagementTile extends StatelessWidget {
|
||||
Icon(
|
||||
icon,
|
||||
size: 48, // Make icon larger
|
||||
color: disabled ? theme.disabledColor : theme.colorScheme.primary,
|
||||
color:
|
||||
disabled ? theme.disabledColor : theme.colorScheme.primary,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
@@ -138,7 +141,9 @@ class ServiceManagementTile extends StatelessWidget {
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: disabled ? theme.disabledColor : theme.colorScheme.onSurface,
|
||||
color: disabled
|
||||
? theme.disabledColor
|
||||
: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user