import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:material_symbols_icons/material_symbols_icons.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../../l10n/app_localizations.dart'; class EnquiryScreen extends StatefulWidget { const EnquiryScreen({super.key}); @override State createState() => _EnquiryScreen(); } class _EnquiryScreen extends State { Future _launchEmailAddress(String email) async { final Uri emailUri = Uri(scheme: 'mailto', path: email); if (await canLaunchUrl(emailUri)) { await launchUrl(emailUri); } else { debugPrint('${AppLocalizations.of(context).emailLaunchError} $email'); } } Future _launchPhoneNumber(String phone) async { final Uri phoneUri = Uri(scheme: 'tel', path: phone); if (await canLaunchUrl(phoneUri)) { await launchUrl(phoneUri); } else { debugPrint('${AppLocalizations.of(context).dialerLaunchError} $phone'); } } Widget _buildContactItem(String role, String email, String phone) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(role, style: const TextStyle(color: Colors.grey)), const SizedBox(height: 4), GestureDetector( onTap: () => _launchEmailAddress(email), child: Text(email, style: TextStyle(color: Theme.of(context).primaryColor)), ), const SizedBox(height: 4), GestureDetector( onTap: () => _launchPhoneNumber(phone), child: Text(phone, style: TextStyle(color: Theme.of(context).scaffoldBackgroundColor)), ), ], ); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( leading: IconButton( icon: const Icon(Symbols.arrow_back_ios_new), onPressed: () { Navigator.pop(context); }, ), title: Text( AppLocalizations.of(context).enquiry, style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500), ), centerTitle: false, actions: [ Padding( padding: const EdgeInsets.only(right: 10.0), child: CircleAvatar( backgroundColor: Colors.grey[200], radius: 20, child: SvgPicture.asset( 'assets/images/avatar_male.svg', width: 40, height: 40, fit: BoxFit.cover, ), ), ), ], ), body: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // … existing Mail us / Call us / Write to us … const SizedBox(height: 20), Text( AppLocalizations.of(context).writeToUs, style: TextStyle(color: Colors.grey), ), const SizedBox(height: 4), Text( "complaint@kccb.in", style: TextStyle(color: Theme.of(context).primaryColor), ), SizedBox(height: 20), Text( AppLocalizations.of(context).keyContacts, style: TextStyle( fontSize: 17, color: Theme.of(context).primaryColor, ), // horizontal line ), Divider(color: Colors.grey[300]), const SizedBox(height: 16), _buildContactItem( AppLocalizations.of(context).chairman, "chairman@kccb.in", "01892-222677", ), const SizedBox(height: 16), _buildContactItem( AppLocalizations.of(context).managingDirector, "md@kccb.in", "01892-224969", ), const SizedBox(height: 16), _buildContactItem( AppLocalizations.of(context).gmWest, "gmw@kccb.in", "01892-223280", ), const SizedBox(height: 16), _buildContactItem( AppLocalizations.of(context).gmNorth, "gmn@kccb.in", "01892-224607", ), ], ), ), ); } }