Quick Links Screen Icon to List
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kmobile/l10n/app_localizations.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -6,6 +8,7 @@
|
||||
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});
|
||||
@@ -84,61 +87,25 @@
|
||||
),
|
||||
),
|
||||
),
|
||||
// Grid of Quick Links
|
||||
GridView.builder(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2, // Two columns
|
||||
crossAxisSpacing: 12.0,
|
||||
mainAxisSpacing: 12.0,
|
||||
childAspectRatio: 1.1, // Adjust for better card shape
|
||||
),
|
||||
// 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 _buildLinkCard(link, context);
|
||||
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),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLinkCard(QuickLink link, BuildContext context) {
|
||||
return Card(
|
||||
elevation: 3.0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(15.0),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () => _launchURL(link.url, context),
|
||||
borderRadius: BorderRadius.circular(15.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
link.icon,
|
||||
size: 40.0,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(height: 12.0),
|
||||
Text(
|
||||
link.title,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14.0,
|
||||
),
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user