Code Formatted
This commit is contained in:
@@ -65,9 +65,8 @@ factory Branch.fromJson(Map<String, dynamic> json) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static List<Branch> listFromJson(List<dynamic> jsonList) {
|
static List<Branch> listFromJson(List<dynamic> jsonList) {
|
||||||
final beneficiaryList = jsonList
|
final beneficiaryList =
|
||||||
.map((beneficiary) => Branch.fromJson(beneficiary))
|
jsonList.map((beneficiary) => Branch.fromJson(beneficiary)).toList();
|
||||||
.toList();
|
|
||||||
return beneficiaryList;
|
return beneficiaryList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
? fromDate!.add(const Duration(days: 183))
|
? fromDate!.add(const Duration(days: 183))
|
||||||
: now;
|
: now;
|
||||||
final initialToDate = toDate ?? now;
|
final initialToDate = toDate ?? now;
|
||||||
final clampedInitialToDate = initialToDate.isBefore(fromDate!) ? fromDate! : initialToDate;
|
final clampedInitialToDate =
|
||||||
|
initialToDate.isBefore(fromDate!) ? fromDate! : initialToDate;
|
||||||
final picked = await showDatePicker(
|
final picked = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialDate: clampedInitialToDate,
|
initialDate: clampedInitialToDate,
|
||||||
@@ -238,8 +239,11 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
itemCount: 3,
|
itemCount: 3,
|
||||||
itemBuilder: (_, __) => ListTile(
|
itemBuilder: (_, __) => ListTile(
|
||||||
leading: Shimmer.fromColors(
|
leading: Shimmer.fromColors(
|
||||||
baseColor: Theme.of(context).colorScheme.surfaceVariant,
|
baseColor:
|
||||||
highlightColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
Theme.of(context).colorScheme.surfaceVariant,
|
||||||
|
highlightColor: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSurfaceVariant,
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
radius: 12,
|
radius: 12,
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
@@ -247,8 +251,11 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
title: Shimmer.fromColors(
|
title: Shimmer.fromColors(
|
||||||
baseColor: Theme.of(context).colorScheme.surfaceVariant,
|
baseColor:
|
||||||
highlightColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
Theme.of(context).colorScheme.surfaceVariant,
|
||||||
|
highlightColor: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSurfaceVariant,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 10,
|
height: 10,
|
||||||
width: 100,
|
width: 100,
|
||||||
@@ -257,8 +264,11 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
subtitle: Shimmer.fromColors(
|
subtitle: Shimmer.fromColors(
|
||||||
baseColor: Theme.of(context).colorScheme.surfaceVariant,
|
baseColor:
|
||||||
highlightColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
Theme.of(context).colorScheme.surfaceVariant,
|
||||||
|
highlightColor: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSurfaceVariant,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 8,
|
height: 8,
|
||||||
width: 60,
|
width: 60,
|
||||||
@@ -288,7 +298,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
? Symbols.call_received
|
? Symbols.call_received
|
||||||
: Symbols.call_made,
|
: Symbols.call_made,
|
||||||
color: tx.type == 'CR'
|
color: tx.type == 'CR'
|
||||||
? Theme.of(context).colorScheme.secondary
|
? Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.secondary
|
||||||
: Theme.of(context).colorScheme.error,
|
: Theme.of(context).colorScheme.error,
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
@@ -332,7 +344,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
separatorBuilder: (context, index) {
|
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) {
|
itemBuilder: (context, index) {
|
||||||
final user = widget.users[index];
|
final user = widget.users[index];
|
||||||
return Padding(
|
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),
|
child: _buildAccountCard(user),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ class BeneficiaryDetailsScreen extends StatelessWidget {
|
|||||||
_showSuccessDialog(context);
|
_showSuccessDialog(context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
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) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(AppLocalizations.of(context).success),
|
title: Text(AppLocalizations.of(context).success),
|
||||||
content: Text(AppLocalizations.of(context).beneficiaryDeletedSuccessfully),
|
content:
|
||||||
|
Text(AppLocalizations.of(context).beneficiaryDeletedSuccessfully),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(AppLocalizations.of(context).ok),
|
child: Text(AppLocalizations.of(context).ok),
|
||||||
@@ -53,8 +56,8 @@ class BeneficiaryDetailsScreen extends StatelessWidget {
|
|||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(AppLocalizations.of(context).deleteBeneficiary),
|
title: Text(AppLocalizations.of(context).deleteBeneficiary),
|
||||||
content:
|
content: Text(AppLocalizations.of(context)
|
||||||
Text(AppLocalizations.of(context).areYouSureYouWantToDeleteThisBeneficiary),
|
.areYouSureYouWantToDeleteThisBeneficiary),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(AppLocalizations.of(context).cancel),
|
child: Text(AppLocalizations.of(context).cancel),
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ class _ChequeManagementScreen extends State<ChequeManagementScreen> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).chequeManagement,
|
AppLocalizations.of(context).chequeManagement,
|
||||||
style:
|
style: TextStyle(
|
||||||
TextStyle(color: Theme.of(context).textTheme.titleLarge?.color, fontWeight: FontWeight.w500),
|
color: Theme.of(context).textTheme.titleLarge?.color,
|
||||||
|
fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -222,7 +222,8 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
if (isSelected) // Only show toggle for selected card
|
if (isSelected) // Only show toggle for selected card
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (isRefreshing) return; // Prevent taps while refreshing
|
if (isRefreshing)
|
||||||
|
return; // Prevent taps while refreshing
|
||||||
final accountNo = user.accountNo;
|
final accountNo = user.accountNo;
|
||||||
if (accountNo == null) return;
|
if (accountNo == null) return;
|
||||||
|
|
||||||
@@ -325,8 +326,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
return Shimmer.fromColors(
|
return Shimmer.fromColors(
|
||||||
baseColor: theme.colorScheme.primary,
|
baseColor: theme.colorScheme.primary,
|
||||||
highlightColor: theme.colorScheme.onPrimary,
|
highlightColor: theme.colorScheme.onPrimary,
|
||||||
child: Container(
|
child: Container(height: 36, color: theme.scaffoldBackgroundColor),
|
||||||
height: 36, color: theme.scaffoldBackgroundColor),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,8 +462,10 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) => ProfileScreen(
|
||||||
ProfileScreen(mobileNumber: mobileNumberToPass, customerNo: customerNo, customerName: customerName),
|
mobileNumber: mobileNumberToPass,
|
||||||
|
customerNo: customerNo,
|
||||||
|
customerName: customerName),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -535,25 +537,31 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
|
|
||||||
// Account Info Cards
|
// Account Info Cards
|
||||||
ClipRect(
|
ClipRect(
|
||||||
child: SizedBox( // This SizedBox defines the height for the Stack
|
child: SizedBox(
|
||||||
|
// This SizedBox defines the height for the Stack
|
||||||
height: 160,
|
height: 160,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
// PageView part, painted underneath
|
// PageView part, painted underneath
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 48.0), // Space for tab (40) + gap (8)
|
padding: const EdgeInsets.only(
|
||||||
child: SizedBox( // Keep SizedBox for PageView height
|
left: 48.0), // Space for tab (40) + gap (8)
|
||||||
|
child: SizedBox(
|
||||||
|
// Keep SizedBox for PageView height
|
||||||
height: 160,
|
height: 160,
|
||||||
child: PageView.builder(
|
child: PageView.builder(
|
||||||
controller: _pageController,
|
controller: _pageController,
|
||||||
itemCount: users.length,
|
itemCount: users.length,
|
||||||
clipBehavior: Clip.none, // Keep this to show adjacent cards
|
clipBehavior: Clip
|
||||||
|
.none, // Keep this to show adjacent cards
|
||||||
padEnds: false,
|
padEnds: false,
|
||||||
onPageChanged: (int newIndex) async {
|
onPageChanged: (int newIndex) async {
|
||||||
if (newIndex == selectedAccountIndex) return;
|
if (newIndex == selectedAccountIndex)
|
||||||
|
return;
|
||||||
|
|
||||||
// Hide the balance of the old card when scrolling away
|
// Hide the balance of the old card when scrolling away
|
||||||
final oldAccountNo = users[selectedAccountIndex].accountNo;
|
final oldAccountNo =
|
||||||
|
users[selectedAccountIndex].accountNo;
|
||||||
if (oldAccountNo != null) {
|
if (oldAccountNo != null) {
|
||||||
_visibilityMap[oldAccountNo] = false;
|
_visibilityMap[oldAccountNo] = false;
|
||||||
}
|
}
|
||||||
@@ -568,8 +576,10 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
},
|
},
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final user = users[index];
|
final user = users[index];
|
||||||
final isSelected = index == selectedAccountIndex;
|
final isSelected =
|
||||||
return _buildAccountCard(user, 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(
|
||||||
icon,
|
icon,
|
||||||
size: 30,
|
size: 30,
|
||||||
color: disable
|
color: disable ? theme.disabledColor : theme.colorScheme.primary,
|
||||||
? theme.disabledColor
|
|
||||||
: theme.colorScheme.primary,
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
@@ -788,9 +795,8 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
style: theme.textTheme.titleMedium?.copyWith(
|
style: theme.textTheme.titleMedium?.copyWith(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: disable
|
color:
|
||||||
? theme.disabledColor
|
disable ? theme.disabledColor : theme.colorScheme.onSurface,
|
||||||
: theme.colorScheme.onSurface,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -799,4 +805,3 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,8 +68,10 @@ class _EnquiryScreen extends State<EnquiryScreen> {
|
|||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => _launchPhoneNumber(phone),
|
onTap: () => _launchPhoneNumber(phone),
|
||||||
child: Text(phone,
|
child: Text(phone,
|
||||||
style:
|
style: TextStyle(
|
||||||
TextStyle(color: Theme.of(context).colorScheme.primary)), // Changed color for visibility
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary)), // Changed color for visibility
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -91,14 +93,16 @@ class _EnquiryScreen extends State<EnquiryScreen> {
|
|||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => _launchUrl("https://kccbhp.bank.in/complaint-form/"),
|
onTap: () =>
|
||||||
|
_launchUrl("https://kccbhp.bank.in/complaint-form/"),
|
||||||
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||||
Text(
|
Text(
|
||||||
"Complaint Form",
|
"Complaint Form",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
decoration: TextDecoration.underline, // Added underline for link clarity
|
decoration: TextDecoration
|
||||||
|
.underline, // Added underline for link clarity
|
||||||
decorationColor:
|
decorationColor:
|
||||||
Theme.of(context).colorScheme.primary,
|
Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -492,7 +492,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
if (_isLoadingLimit) Text(AppLocalizations.of(context).fetchingDailyLimit),
|
if (_isLoadingLimit)
|
||||||
|
Text(AppLocalizations.of(context).fetchingDailyLimit),
|
||||||
if (!_isLoadingLimit && _limit != null)
|
if (!_isLoadingLimit && _limit != null)
|
||||||
Text(
|
Text(
|
||||||
'Remaining Daily Limit: ${_formatCurrency.format(_limit!.dailyLimit - _limit!.usedLimit)}',
|
'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
|
elevation: 4, // Add some elevation for better visual separation
|
||||||
child: InkWell(
|
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),
|
borderRadius: BorderRadius.circular(12.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 16.0),
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ class ProfileScreen extends StatefulWidget {
|
|||||||
final String mobileNumber;
|
final String mobileNumber;
|
||||||
final String customerNo;
|
final String customerNo;
|
||||||
final String customerName;
|
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
|
@override
|
||||||
State<ProfileScreen> createState() => _ProfileScreenState();
|
State<ProfileScreen> createState() => _ProfileScreenState();
|
||||||
@@ -357,8 +361,8 @@ Widget build(BuildContext context) {
|
|||||||
Text(
|
Text(
|
||||||
widget.customerNo,
|
widget.customerNo,
|
||||||
style: theme.textTheme.bodyMedium?.copyWith(
|
style: theme.textTheme.bodyMedium?.copyWith(
|
||||||
color:
|
color: theme.colorScheme.onSurface
|
||||||
theme.colorScheme.onSurface.withOpacity(0.7),
|
.withOpacity(0.7),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -611,8 +615,7 @@ class _SectionTile extends StatelessWidget {
|
|||||||
? Icon(Icons.chevron_right, color: theme.colorScheme.onSurface)
|
? Icon(Icons.chevron_right, color: theme.colorScheme.onSurface)
|
||||||
: null,
|
: null,
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
contentPadding:
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ class SecuritySettingsScreen extends StatelessWidget {
|
|||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(loc.mpinChangedSuccessfully),
|
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
|
elevation: 4, // Add some elevation for better visual separation
|
||||||
child: InkWell(
|
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),
|
borderRadius: BorderRadius.circular(12.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 36.0, horizontal: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 36.0, horizontal: 16.0),
|
||||||
|
|||||||
@@ -15,10 +15,12 @@ class ATMLocatorScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
|
class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
|
||||||
final TextEditingController _searchController = TextEditingController();
|
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
|
bool _isLoading = true; // State variable to manage loading status
|
||||||
List<Atm> _allAtms = []; // Changed: List to hold all fetched Atm objects
|
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
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -28,7 +30,8 @@ class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
|
|||||||
|
|
||||||
/// Fetches the list of ATMs from the API using BranchService.
|
/// Fetches the list of ATMs from the API using BranchService.
|
||||||
Future<void> _loadAtms() async {
|
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(() {
|
setState(() {
|
||||||
_allAtms = data; // Update the list of all ATMs
|
_allAtms = data; // Update the list of all ATMs
|
||||||
_filteredAtms = data; // Initialize filtered list with 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.
|
/// 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(() {
|
setState(() {
|
||||||
if (query.isEmpty) {
|
if (query.isEmpty) {
|
||||||
_filteredAtms = _allAtms; // If query is empty, show all ATMs
|
_filteredAtms = _allAtms; // If query is empty, show all ATMs
|
||||||
} else {
|
} 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();
|
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();
|
}).toList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -64,7 +71,8 @@ class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
|
|||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _searchController,
|
controller: _searchController,
|
||||||
onChanged: _filterAtms, // Updated: Call _filterAtms on text change
|
onChanged:
|
||||||
|
_filterAtms, // Updated: Call _filterAtms on text change
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Name/Address", // Hint text for the search bar
|
hintText: "Name/Address", // Hint text for the search bar
|
||||||
prefixIcon: const Icon(Icons.search), // Search icon
|
prefixIcon: const Icon(Icons.search), // Search icon
|
||||||
@@ -81,12 +89,16 @@ class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
|
|||||||
? _buildShimmerList() // Display shimmer while loading
|
? _buildShimmerList() // Display shimmer while loading
|
||||||
: _filteredAtms.isEmpty
|
: _filteredAtms.isEmpty
|
||||||
? const Center(
|
? 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(
|
: 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) {
|
itemBuilder: (context, index) {
|
||||||
final atm = _filteredAtms[index]; // Get the current Atm object
|
final atm = _filteredAtms[
|
||||||
return _buildAtmItem(atm); // Build the ATM list item
|
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.
|
/// 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(
|
return Card(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
|
|||||||
@@ -81,7 +81,8 @@
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: theme.colorScheme.primary, // Indicate it's clickable
|
color:
|
||||||
|
theme.colorScheme.primary, // Indicate it's clickable
|
||||||
decoration: TextDecoration.underline,
|
decoration: TextDecoration.underline,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -98,6 +99,7 @@
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _launchUrl(String urlString) async {
|
Future<void> _launchUrl(String urlString) async {
|
||||||
final Uri url = Uri.parse(urlString);
|
final Uri url = Uri.parse(urlString);
|
||||||
if (!await launchUrl(url)) {
|
if (!await launchUrl(url)) {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import 'package:kmobile/di/injection.dart';
|
|||||||
import 'package:shimmer/shimmer.dart';
|
import 'package:shimmer/shimmer.dart';
|
||||||
import 'package:kmobile/features/service/screens/branch_details_screen.dart';
|
import 'package:kmobile/features/service/screens/branch_details_screen.dart';
|
||||||
|
|
||||||
|
|
||||||
class BranchLocatorScreen extends StatefulWidget {
|
class BranchLocatorScreen extends StatefulWidget {
|
||||||
const BranchLocatorScreen({super.key});
|
const BranchLocatorScreen({super.key});
|
||||||
|
|
||||||
@@ -51,7 +50,6 @@ class BranchLocatorScreen extends StatefulWidget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -88,11 +86,13 @@ class BranchLocatorScreen extends StatefulWidget {
|
|||||||
? _buildShimmerList() // Changed to shimmer
|
? _buildShimmerList() // Changed to shimmer
|
||||||
: _filteredBranches.isEmpty
|
: _filteredBranches.isEmpty
|
||||||
? const Center(
|
? const Center(
|
||||||
child: Text("No matching branches found")) // Updated tex
|
child: Text(
|
||||||
|
"No matching branches found")) // Updated tex
|
||||||
: ListView.builder(
|
: ListView.builder(
|
||||||
itemCount: _filteredBranches.length,
|
itemCount: _filteredBranches.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final branch = _filteredBranches[index]; // Changed to
|
final branch =
|
||||||
|
_filteredBranches[index]; // Changed to
|
||||||
return _buildBranchItem(branch); // Updated
|
return _buildBranchItem(branch); // Updated
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -155,7 +155,6 @@ class BranchLocatorScreen extends StatefulWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Shimmer loading list
|
// Shimmer loading list
|
||||||
Widget _buildShimmerList() {
|
Widget _buildShimmerList() {
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ class _ServiceScreen extends State<ServiceScreen> {
|
|||||||
label: AppLocalizations.of(context).faq,
|
label: AppLocalizations.of(context).faq,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(builder: (context) => const FaqsScreen()),
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const FaqsScreen()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@@ -120,7 +121,8 @@ class ServiceManagementTile extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
elevation: 4, // Add some elevation for better visual separation
|
elevation: 4, // Add some elevation for better visual separation
|
||||||
child: InkWell(
|
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),
|
borderRadius: BorderRadius.circular(12.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 16.0),
|
||||||
@@ -130,7 +132,8 @@ class ServiceManagementTile extends StatelessWidget {
|
|||||||
Icon(
|
Icon(
|
||||||
icon,
|
icon,
|
||||||
size: 48, // Make icon larger
|
size: 48, // Make icon larger
|
||||||
color: disabled ? theme.disabledColor : theme.colorScheme.primary,
|
color:
|
||||||
|
disabled ? theme.disabledColor : theme.colorScheme.primary,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Text(
|
Text(
|
||||||
@@ -138,7 +141,9 @@ class ServiceManagementTile extends StatelessWidget {
|
|||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: theme.textTheme.titleLarge?.copyWith(
|
style: theme.textTheme.titleLarge?.copyWith(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: disabled ? theme.disabledColor : theme.colorScheme.onSurface,
|
color: disabled
|
||||||
|
? theme.disabledColor
|
||||||
|
: theme.colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user