Quick Links added

This commit is contained in:
2025-11-14 15:24:02 +05:30
parent 3135116f26
commit 43d92d799b
4 changed files with 257 additions and 88 deletions

View File

@@ -40,6 +40,20 @@
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT. https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. --> In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" />
</intent>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
</intent>
</queries>
<queries> <queries>
<intent> <intent>
<action android:name="android.intent.action.PROCESS_TEXT"/> <action android:name="android.intent.action.PROCESS_TEXT"/>

View File

@@ -1,5 +1,3 @@
// ignore_for_file: use_build_context_synchronously
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
@@ -12,31 +10,45 @@ class EnquiryScreen extends StatefulWidget {
} }
class _EnquiryScreen extends State<EnquiryScreen> { class _EnquiryScreen extends State<EnquiryScreen> {
// Updated to launch externally and pre-fill the subject
Future<void> _launchEmailAddress(String email) async { Future<void> _launchEmailAddress(String email) async {
final Uri emailUri = Uri(scheme: 'mailto', path: email); final Uri emailUri = Uri(
scheme: 'mailto',
path: email,
query: 'subject=Enquiry', // Pre-fills the subject line
);
if (await canLaunchUrl(emailUri)) { if (await canLaunchUrl(emailUri)) {
await launchUrl(emailUri); // Use external application mode
await launchUrl(emailUri, mode: LaunchMode.externalApplication);
} else { } else {
debugPrint('${AppLocalizations.of(context).emailLaunchError} $email'); ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Could not open email app for $email')),
);
} }
} }
// Updated with better error handling
Future<void> _launchPhoneNumber(String phone) async { Future<void> _launchPhoneNumber(String phone) async {
final Uri phoneUri = Uri(scheme: 'tel', path: phone); final Uri phoneUri = Uri(scheme: 'tel', path: phone);
if (await canLaunchUrl(phoneUri)) { if (await canLaunchUrl(phoneUri)) {
await launchUrl(phoneUri); await launchUrl(phoneUri);
} else { } else {
debugPrint('${AppLocalizations.of(context).dialerLaunchError} $phone'); ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Could not open dialer for $phone')),
);
} }
} }
// Updated to launch externally
Future<void> _launchUrl(String url) async { Future<void> _launchUrl(String url) async {
final Uri uri = Uri.parse(url); final Uri uri = Uri.parse(url);
if (await canLaunchUrl(uri)) { if (await canLaunchUrl(uri)) {
await launchUrl(uri); // Use external application mode
await launchUrl(uri, mode: LaunchMode.externalApplication);
} else { } else {
// Consider adding a 'urlLaunchError' key to your AppLocalizations ScaffoldMessenger.of(context).showSnackBar(
debugPrint('Could not launch $url'); SnackBar(content: Text('Could not launch $url')),
);
} }
} }
@@ -57,7 +69,7 @@ class _EnquiryScreen extends State<EnquiryScreen> {
onTap: () => _launchPhoneNumber(phone), onTap: () => _launchPhoneNumber(phone),
child: Text(phone, child: Text(phone,
style: style:
TextStyle(color: Theme.of(context).scaffoldBackgroundColor)), TextStyle(color: Theme.of(context).colorScheme.primary)), // Changed color for visibility
), ),
], ],
); );
@@ -79,13 +91,14 @@ class _EnquiryScreen extends State<EnquiryScreen> {
children: [ children: [
const SizedBox(height: 20), const SizedBox(height: 20),
GestureDetector( GestureDetector(
onTap: () => _launchUrl("https://kccb.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
decorationColor: decorationColor:
Theme.of(context).colorScheme.primary, Theme.of(context).colorScheme.primary,
), ),

View File

@@ -1,6 +1,14 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:kmobile/l10n/app_localizations.dart'; import 'package:kmobile/l10n/app_localizations.dart';
// Data model for a single FAQ item
class FaqItem {
final String question;
final String answer;
FaqItem({required this.question, required this.answer});
}
class FaqsScreen extends StatefulWidget { class FaqsScreen extends StatefulWidget {
const FaqsScreen({super.key}); const FaqsScreen({super.key});
@@ -9,53 +17,93 @@ class FaqsScreen extends StatefulWidget {
} }
class _FaqsScreenState extends State<FaqsScreen> { class _FaqsScreenState extends State<FaqsScreen> {
@override // List of FAQs
void initState() { final List<FaqItem> _faqs = [
super.initState(); FaqItem(
_getFaqs(); question: "How do I log in to the mobile banking app?",
} answer:
"You can log in using your customer number and password. Biometric login (fingerprint) and MPIN is also available for supported devices.",
// A placeholder for your future API call ),
Future<void> _getFaqs() async { FaqItem(
// TODO: Implement API call to fetch FAQs data question: "Is my banking information secure on this app?",
// For now, simulating a network call with a delay answer:
await Future.delayed(const Duration(seconds: 1)); "Yes. We use industry-standard encryption and multi-factor authentication to ensure your data is safe.",
// In a real implementation, you would process the API response here ),
} FaqItem(
question: "How can I check my account balance?",
answer:
"Once logged in, your account balance will be displayed on the home screen. You can also view detailed balances under the “Accounts” section.",
),
FaqItem(
question: "Can I transfer money to other bank accounts?",
answer:
"Yes. You can use NEFT, RTGS or IMPS to transfer funds to any bank account in India.",
),
FaqItem(
question: "How do I view my transaction history?",
answer:
"Click on the “Account Statement” icon under the Home Screen to view recent and past transactions.",
),
];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Row( title: Text(AppLocalizations.of(context).faq),
children: [
Flexible(
child: Text(
AppLocalizations.of(context).faq,
softWrap: true,
style: const TextStyle(
fontSize: 16.5,
),
textAlign: TextAlign.left,
),
),
],
),
), ),
body: Stack( body: Stack(
children: [ children: [
// Background logo
IgnorePointer( IgnorePointer(
child: Center( child: Center(
child: Opacity( child: Opacity(
opacity: 0.1, // Low opacity opacity: 0.1,
child: Image.asset( child: Image.asset(
'assets/images/logo.png', 'assets/images/logo.png',
width: 200, // Adjust size as needed width: 200,
height: 200, // Adjust size as needed height: 200,
), ),
), ),
), ),
), ),
// FAQ List
ListView.builder(
padding: const EdgeInsets.all(8.0),
itemCount: _faqs.length,
itemBuilder: (context, index) {
final faq = _faqs[index];
return Card(
margin:
const EdgeInsets.symmetric(vertical: 8.0, horizontal: 4.0),
elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),
child: ExpansionTile(
title: Text(
faq.question,
style: const TextStyle(
fontWeight: FontWeight.w600,
),
),
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(16.0, 0, 16.0, 16.0),
child: Text(
faq.answer,
style: TextStyle(
fontSize: 14,
color: Colors.grey[700],
height: 1.5,
),
),
),
],
),
);
},
),
], ],
), ),
); );

View File

@@ -1,26 +1,66 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:kmobile/l10n/app_localizations.dart'; import 'package:kmobile/l10n/app_localizations.dart';
import 'package:url_launcher/url_launcher.dart';
class QuickLinksScreen extends StatefulWidget { // Data model for a single Quick Link item
class QuickLink {
final String title;
final String url;
final IconData icon;
QuickLink({required this.title, required this.url, required this.icon});
}
class QuickLinksScreen extends StatefulWidget {
const QuickLinksScreen({super.key}); const QuickLinksScreen({super.key});
@override @override
State<QuickLinksScreen> createState() => _QuickLinksScreenState(); State<QuickLinksScreen> createState() => _QuickLinksScreenState();
}
class _QuickLinksScreenState extends State<QuickLinksScreen> {
@override
void initState() {
super.initState();
_getQuickLinks();
} }
// A placeholder for your future API call class _QuickLinksScreenState extends State<QuickLinksScreen> {
Future<void> _getQuickLinks() async { // List of Quick Links
// TODO: Implement API call to fetch quick links data final List<QuickLink> _quickLinks = [
// For now, simulating a network call with a delay QuickLink(
await Future.delayed(const Duration(seconds: 1)); title: "National Bank of Agriculture & Rural Development",
// In a real implementation, you would process the API response here 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 @override
@@ -31,20 +71,74 @@ class _QuickLinksScreenState extends State<QuickLinksScreen> {
), ),
body: Stack( body: Stack(
children: [ children: [
// Background logo
IgnorePointer( IgnorePointer(
child: Center( child: Center(
child: Opacity( child: Opacity(
opacity: 0.1, // Low opacity opacity: 0.1,
child: Image.asset( child: Image.asset(
'assets/images/logo.png', 'assets/images/logo.png',
width: 200, // Adjust size as needed width: 200,
height: 200, // Adjust size as needed height: 200,
), ),
), ),
), ),
), ),
// 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
),
itemCount: _quickLinks.length,
itemBuilder: (context, index) {
final link = _quickLinks[index];
return _buildLinkCard(link, 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,
),
],
),
),
),
);
}
}