Code Formatted
This commit is contained in:
@@ -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,107 +1,109 @@
|
||||
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 {
|
||||
final Branch branch;
|
||||
class BranchDetailsScreen extends StatelessWidget {
|
||||
final Branch branch;
|
||||
|
||||
const BranchDetailsScreen({super.key, required this.branch});
|
||||
const BranchDetailsScreen({super.key, required this.branch});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(branch.branch_name),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildDetailRow(context, "Branch Name", branch.branch_name),
|
||||
_buildDetailRow(context, "Branch Code", branch.branch_code),
|
||||
_buildDetailRow(context, "Zone", branch.zone),
|
||||
_buildDetailRow(context, "Tehsil", branch.tehsil),
|
||||
_buildDetailRow(context, "Block", branch.block),
|
||||
_buildDetailRow(context, "District", branch.distt_name),
|
||||
_buildDetailRow(context, "Pincode", branch.pincode),
|
||||
// _buildDetailRow(context, "Post Office", branch.post_office),
|
||||
// _buildDetailRow(context, "Date of Opening", branch.date_of_opening),
|
||||
// _buildDetailRow(context, "Branch Type", branch.type_of_branch),
|
||||
_buildDetailRow(context, "Telephone No.", branch.telephone_no),
|
||||
// _buildDetailRow("RTGS Account No.", branch.rtgs_acct_no),
|
||||
// _buildDetailRow("RBI Code 1", branch.rbi_code_1),
|
||||
// _buildDetailRow("RBI Code 2", branch.rbi_code_2),
|
||||
// _buildDetailRow("Latitude", branch.br_lattitude),
|
||||
// _buildDetailRow("Longitude", branch.br_longitude),
|
||||
],
|
||||
),
|
||||
),
|
||||
IgnorePointer(
|
||||
child: Center(
|
||||
child: Opacity(
|
||||
opacity: 0.07, // Reduced opacity
|
||||
child: ClipOval(
|
||||
child: Image.asset(
|
||||
'assets/images/logo.png',
|
||||
width: 200, // Adjust size as needed
|
||||
height: 200, // Adjust size as needed
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(branch.branch_name),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildDetailRow(context, "Branch Name", branch.branch_name),
|
||||
_buildDetailRow(context, "Branch Code", branch.branch_code),
|
||||
_buildDetailRow(context, "Zone", branch.zone),
|
||||
_buildDetailRow(context, "Tehsil", branch.tehsil),
|
||||
_buildDetailRow(context, "Block", branch.block),
|
||||
_buildDetailRow(context, "District", branch.distt_name),
|
||||
_buildDetailRow(context, "Pincode", branch.pincode),
|
||||
// _buildDetailRow(context, "Post Office", branch.post_office),
|
||||
// _buildDetailRow(context, "Date of Opening", branch.date_of_opening),
|
||||
// _buildDetailRow(context, "Branch Type", branch.type_of_branch),
|
||||
_buildDetailRow(context, "Telephone No.", branch.telephone_no),
|
||||
// _buildDetailRow("RTGS Account No.", branch.rtgs_acct_no),
|
||||
// _buildDetailRow("RBI Code 1", branch.rbi_code_1),
|
||||
// _buildDetailRow("RBI Code 2", branch.rbi_code_2),
|
||||
// _buildDetailRow("Latitude", branch.br_lattitude),
|
||||
// _buildDetailRow("Longitude", branch.br_longitude),
|
||||
],
|
||||
),
|
||||
),
|
||||
IgnorePointer(
|
||||
child: Center(
|
||||
child: Opacity(
|
||||
opacity: 0.07, // Reduced opacity
|
||||
child: ClipOval(
|
||||
child: Image.asset(
|
||||
'assets/images/logo.png',
|
||||
width: 200, // Adjust size as needed
|
||||
height: 200, // Adjust size as needed
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDetailRow(BuildContext context, String label, String value) {
|
||||
final theme = Theme.of(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: theme.textTheme.bodySmall?.color,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
label == "Telephone No."
|
||||
? InkWell(
|
||||
onTap: () => _launchUrl('tel:$value'),
|
||||
child: Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: theme.colorScheme.primary, // Indicate it's clickable
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Divider(height: 16, color: theme.dividerColor),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Future<void> _launchUrl(String urlString) async {
|
||||
final Uri url = Uri.parse(urlString);
|
||||
if (!await launchUrl(url)) {
|
||||
throw 'Could not launch $urlString';
|
||||
}
|
||||
}
|
||||
}
|
||||
Widget _buildDetailRow(BuildContext context, String label, String value) {
|
||||
final theme = Theme.of(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: theme.textTheme.bodySmall?.color,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
label == "Telephone No."
|
||||
? InkWell(
|
||||
onTap: () => _launchUrl('tel:$value'),
|
||||
child: Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
theme.colorScheme.primary, // Indicate it's clickable
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Divider(height: 16, color: theme.dividerColor),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
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,52 +14,51 @@ class BranchLocatorScreen extends StatefulWidget {
|
||||
State<BranchLocatorScreen> createState() => _BranchLocatorScreenState();
|
||||
}
|
||||
|
||||
class _BranchLocatorScreenState extends State<BranchLocatorScreen> {
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
var service = getIt<BranchService>();
|
||||
bool _isLoading = true;
|
||||
List<Branch> _allBranches = [];
|
||||
List<Branch> _filteredBranches = [];
|
||||
class _BranchLocatorScreenState extends State<BranchLocatorScreen> {
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
var service = getIt<BranchService>();
|
||||
bool _isLoading = true;
|
||||
List<Branch> _allBranches = [];
|
||||
List<Branch> _filteredBranches = [];
|
||||
|
||||
@override
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// _fetchAndSetLocations();
|
||||
_loadBranches();
|
||||
}
|
||||
|
||||
Future<void> _loadBranches() async {
|
||||
final data = await service.fetchBranchList();
|
||||
setState(() {
|
||||
_allBranches = data;
|
||||
_filteredBranches = data;
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
Future<void> _loadBranches() async {
|
||||
final data = await service.fetchBranchList();
|
||||
setState(() {
|
||||
_allBranches = data;
|
||||
_filteredBranches = data;
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
void _filterBranches(String query) {
|
||||
setState(() {
|
||||
if (query.isEmpty) {
|
||||
_filteredBranches = _allBranches;
|
||||
} else {
|
||||
_filteredBranches = _allBranches.where((branch) {
|
||||
final lowerQuery = query.toLowerCase();
|
||||
return branch.branch_name.toLowerCase().contains(lowerQuery);
|
||||
}).toList();
|
||||
}
|
||||
});
|
||||
}
|
||||
setState(() {
|
||||
if (query.isEmpty) {
|
||||
_filteredBranches = _allBranches;
|
||||
} else {
|
||||
_filteredBranches = _allBranches.where((branch) {
|
||||
final lowerQuery = query.toLowerCase();
|
||||
return branch.branch_name.toLowerCase().contains(lowerQuery);
|
||||
}).toList();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
"Branch Locator",
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Stack(
|
||||
@@ -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
|
||||
},
|
||||
),
|
||||
@@ -132,7 +132,7 @@ class BranchLocatorScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
// Helper widget to build a single branch item
|
||||
|
||||
|
||||
Widget _buildBranchItem(Branch branch) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
@@ -155,7 +155,6 @@ class BranchLocatorScreen extends StatefulWidget {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Shimmer loading list
|
||||
Widget _buildShimmerList() {
|
||||
return ListView.builder(
|
||||
|
||||
@@ -110,4 +110,4 @@ class _FaqsScreenState extends State<FaqsScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,113 +1,113 @@
|
||||
//
|
||||
//
|
||||
|
||||
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 {
|
||||
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;
|
||||
// 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});
|
||||
}
|
||||
QuickLink({required this.title, required this.url, required this.icon});
|
||||
}
|
||||
|
||||
class QuickLinksScreen extends StatefulWidget {
|
||||
const QuickLinksScreen({super.key});
|
||||
class QuickLinksScreen extends StatefulWidget {
|
||||
const QuickLinksScreen({super.key});
|
||||
|
||||
@override
|
||||
State<QuickLinksScreen> createState() => _QuickLinksScreenState();
|
||||
}
|
||||
@override
|
||||
State<QuickLinksScreen> createState() => _QuickLinksScreenState();
|
||||
}
|
||||
|
||||
class _QuickLinksScreenState extends State<QuickLinksScreen> {
|
||||
// List of Quick Links
|
||||
final List<QuickLink> _quickLinks = [
|
||||
QuickLink(
|
||||
title: "National Bank of Agriculture & Rural Development",
|
||||
url: "http://www.nabard.org/",
|
||||
icon: Icons.account_balance),
|
||||
QuickLink(
|
||||
title: "Reserve Bank of India",
|
||||
url: "http://www.rbi.org.in/home.aspx",
|
||||
icon: Icons.account_balance_wallet),
|
||||
QuickLink(
|
||||
title: "Indian Institute of Banking & Finance",
|
||||
url: "http://www.iibf.org.in/",
|
||||
icon: Icons.school),
|
||||
QuickLink(
|
||||
title: "Indian Bank Association",
|
||||
url: "http://www.iba.org.in/",
|
||||
icon: Icons.group_work),
|
||||
QuickLink(
|
||||
title: "Ministry of Finance",
|
||||
url: "http://www.finmin.nic.in/",
|
||||
icon: Icons.business),
|
||||
QuickLink(
|
||||
title: "Securities Exchange Board of India",
|
||||
url: "http://www.sebi.gov.in/",
|
||||
icon: Icons.show_chart),
|
||||
QuickLink(
|
||||
title: "Insurance Regulatory & Development Authority",
|
||||
url: "https://www.irdai.gov.in/",
|
||||
icon: Icons.shield_outlined),
|
||||
];
|
||||
class _QuickLinksScreenState extends State<QuickLinksScreen> {
|
||||
// List of Quick Links
|
||||
final List<QuickLink> _quickLinks = [
|
||||
QuickLink(
|
||||
title: "National Bank of Agriculture & Rural Development",
|
||||
url: "http://www.nabard.org/",
|
||||
icon: Icons.account_balance),
|
||||
QuickLink(
|
||||
title: "Reserve Bank of India",
|
||||
url: "http://www.rbi.org.in/home.aspx",
|
||||
icon: Icons.account_balance_wallet),
|
||||
QuickLink(
|
||||
title: "Indian Institute of Banking & Finance",
|
||||
url: "http://www.iibf.org.in/",
|
||||
icon: Icons.school),
|
||||
QuickLink(
|
||||
title: "Indian Bank Association",
|
||||
url: "http://www.iba.org.in/",
|
||||
icon: Icons.group_work),
|
||||
QuickLink(
|
||||
title: "Ministry of Finance",
|
||||
url: "http://www.finmin.nic.in/",
|
||||
icon: Icons.business),
|
||||
QuickLink(
|
||||
title: "Securities Exchange Board of India",
|
||||
url: "http://www.sebi.gov.in/",
|
||||
icon: Icons.show_chart),
|
||||
QuickLink(
|
||||
title: "Insurance Regulatory & Development Authority",
|
||||
url: "https://www.irdai.gov.in/",
|
||||
icon: Icons.shield_outlined),
|
||||
];
|
||||
|
||||
// Function to launch a URL
|
||||
Future<void> _launchURL(String url, BuildContext context) async {
|
||||
final Uri uri = Uri.parse(url);
|
||||
if (await canLaunchUrl(uri)) {
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Could not launch $url')),
|
||||
);
|
||||
}
|
||||
}
|
||||
// Function to launch a URL
|
||||
Future<void> _launchURL(String url, BuildContext context) async {
|
||||
final Uri uri = Uri.parse(url);
|
||||
if (await canLaunchUrl(uri)) {
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Could not launch $url')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context).quickLinks),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
// Background logo
|
||||
IgnorePointer(
|
||||
child: Center(
|
||||
child: Opacity(
|
||||
opacity: 0.07,
|
||||
child: ClipOval(
|
||||
child: Image.asset(
|
||||
'assets/images/logo.png',
|
||||
width: 200,
|
||||
height: 200,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// UPDATED: List of Quick Links
|
||||
ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
itemCount: _quickLinks.length,
|
||||
itemBuilder: (context, index) {
|
||||
final link = _quickLinks[index];
|
||||
return Card(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(vertical: 4.0, horizontal: 8.0),
|
||||
child: ListTile(
|
||||
title: Text(link.title),
|
||||
trailing: const Icon(Icons.open_in_new, size: 20),
|
||||
onTap: () => _launchURL(link.url, context),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context).quickLinks),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
// Background logo
|
||||
IgnorePointer(
|
||||
child: Center(
|
||||
child: Opacity(
|
||||
opacity: 0.07,
|
||||
child: ClipOval(
|
||||
child: Image.asset(
|
||||
'assets/images/logo.png',
|
||||
width: 200,
|
||||
height: 200,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// UPDATED: List of Quick Links
|
||||
ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
itemCount: _quickLinks.length,
|
||||
itemBuilder: (context, index) {
|
||||
final link = _quickLinks[index];
|
||||
return Card(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(vertical: 4.0, horizontal: 8.0),
|
||||
child: ListTile(
|
||||
title: Text(link.title),
|
||||
trailing: const Icon(Icons.open_in_new, size: 20),
|
||||
onTap: () => _launchURL(link.url, context),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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