113 lines
3.5 KiB
Dart
113 lines
3.5 KiB
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;
|
|
|
|
QuickLink({required this.title, required this.url, required this.icon});
|
|
}
|
|
|
|
class QuickLinksScreen extends StatefulWidget {
|
|
const QuickLinksScreen({super.key});
|
|
|
|
@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),
|
|
];
|
|
|
|
// 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),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |