From f3c98df5170250d6f838a5ac9dc838670b72cf53 Mon Sep 17 00:00:00 2001 From: Vinayakkadge04 Date: Tue, 11 Nov 2025 14:13:07 +0530 Subject: [PATCH] worked on launch_url for redirect call & email --- android/app/src/main/AndroidManifest.xml | 35 ++- .../res/drawable-v21/launch_background.xml | 6 + .../main/res/drawable/launch_background.xml | 6 + .../attraction_details_view.dart | 293 ++++++++++-------- pubspec.lock | 64 ++++ pubspec.yaml | 1 + 6 files changed, 271 insertions(+), 134 deletions(-) create mode 100644 android/app/src/main/res/drawable-v21/launch_background.xml create mode 100644 android/app/src/main/res/drawable/launch_background.xml diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index f04627e..65feb87 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,33 +1,42 @@ - - + + + + android:icon="@mipmap/launcher_icon" + android:label="CityCard Customer"> + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" /> - - + + + + + + + + + + + - - + + diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f88598c --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..f88598c --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/lib/attraction_details/attraction_details_view.dart b/lib/attraction_details/attraction_details_view.dart index df35050..fbb1a5b 100644 --- a/lib/attraction_details/attraction_details_view.dart +++ b/lib/attraction_details/attraction_details_view.dart @@ -3,12 +3,36 @@ import 'package:citycards_customer/common_packages/app_bar.dart'; import 'package:citycards_customer/common_packages/custom_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../core/route_constants.dart'; class AttractionDetailsView extends StatelessWidget { const AttractionDetailsView({super.key}); + + Future _makePhoneCall(String phoneNumber) async { + final Uri url = Uri(scheme: 'tel', path: phoneNumber); + if (await canLaunchUrl(url)) { + await launchUrl(url); + } else { + throw 'Could not launch $url'; + } + } + + Future _sendEmail(String emailAddress) async { + final Uri url = Uri( + scheme: 'mailto', + path: emailAddress, + query: 'subject=Hello City Cards&body=Hi there,', // optional + ); + if (await canLaunchUrl(url)) { + await launchUrl(url); + } else { + throw 'Could not launch $url'; + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -18,7 +42,6 @@ class AttractionDetailsView extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Stack( children: [ Image.asset( @@ -33,12 +56,18 @@ class AttractionDetailsView extends StatelessWidget { right: 0, child: SafeArea( child: Padding( - padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h), + padding: EdgeInsets.symmetric( + horizontal: 20.w, + vertical: 10.h, + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - - CommonAppBar(isWhiteLogo: true, isProfilePage: false, showDivider: true,), + CommonAppBar( + isWhiteLogo: true, + isProfilePage: false, + showDivider: true, + ), SizedBox(height: 10.h), @@ -156,108 +185,118 @@ class AttractionDetailsView extends StatelessWidget { ), ), SizedBox(height: 16.h), - Container( - padding: EdgeInsets.symmetric( - horizontal: 12.w, - vertical: 12.h, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.r), - border: Border.all(color: Color(0xFFF95F62)), - ), - child: Row( - children: [ - Icon( - Icons.call, - color: Color(0xFFF95F62), - size: 32.w, - ), - SizedBox(width: 16.w), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CustomText( - text: "Contact Number", - color: Colors.black.withOpacity(.6), - size: 12.sp, - weight: FontWeight.w500, - ), - SizedBox(height: 6.h), - CustomText( - text: "+1012 3456 789", - color: Colors.black, - size: 14.sp, - weight: FontWeight.w600, - ), - - SizedBox(height: 6.h), - CustomText( - text: "Tap to call", - color: Colors.black.withOpacity(.4), - size: 12.sp, - weight: FontWeight.w400, - ), - ], + InkWell( + onTap: () => _makePhoneCall('+10123456789'), + borderRadius: BorderRadius.circular(8.r), + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 12.w, + vertical: 12.h, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.r), + border: Border.all(color: Color(0xFFF95F62)), + ), + child: Row( + children: [ + Icon( + Icons.call, + color: Color(0xFFF95F62), + size: 32.w, ), - ), - ], + SizedBox(width: 16.w), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomText( + text: "Contact Number", + color: Colors.black.withOpacity(.6), + size: 12.sp, + weight: FontWeight.w500, + ), + SizedBox(height: 6.h), + CustomText( + text: "+1012 3456 789", + color: Colors.black, + size: 14.sp, + weight: FontWeight.w600, + ), + + SizedBox(height: 6.h), + CustomText( + text: "Tap to call", + color: Colors.black.withOpacity(.4), + size: 12.sp, + weight: FontWeight.w400, + ), + ], + ), + ), + ], + ), ), ), SizedBox(height: 16.h), - Container( - padding: EdgeInsets.symmetric( - horizontal: 12.w, - vertical: 12.h, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.r), - border: Border.all(color: Color(0xFFF95F62)), - ), - child: Row( - children: [ - Icon( - Icons.email_sharp, - color: Color(0xFFF95F62), - size: 32.w, - ), - SizedBox(width: 16.w), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CustomText( - text: "Email", - color: Colors.black.withOpacity(.6), - size: 12.sp, - weight: FontWeight.w500, - ), - SizedBox(height: 6.h), - CustomText( - text: "CityCards24@gmail.com", - color: Colors.black, - size: 14.sp, - weight: FontWeight.w600, - ), - - SizedBox(height: 6.h), - CustomText( - text: "Tap to email", - color: Colors.black.withOpacity(.4), - size: 12.sp, - weight: FontWeight.w400, - ), - ], + InkWell( + onTap: () => _sendEmail('CityCards24@gmail.com'), + borderRadius: BorderRadius.circular(8.r), + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 12.w, + vertical: 12.h, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.r), + border: Border.all(color: Color(0xFFF95F62)), + ), + child: Row( + children: [ + Icon( + Icons.email_sharp, + color: Color(0xFFF95F62), + size: 32.w, ), - ), - ], + SizedBox(width: 16.w), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomText( + text: "Email", + color: Colors.black.withOpacity(.6), + size: 12.sp, + weight: FontWeight.w500, + ), + SizedBox(height: 6.h), + CustomText( + text: "CityCards24@gmail.com", + color: Colors.black, + size: 14.sp, + weight: FontWeight.w600, + ), + + SizedBox(height: 6.h), + CustomText( + text: "Tap to email", + color: Colors.black.withOpacity(.4), + size: 12.sp, + weight: FontWeight.w400, + ), + ], + ), + ), + ], + ), ), ), SizedBox(height: 16.h), InkWell( - onTap: (){ - Navigator.of(context).pushNamed(RouteConstants.makeBooking); + onTap: () { + Navigator.of( + context, + ).pushNamed(RouteConstants.makeBooking); }, child: Container( padding: EdgeInsets.symmetric( @@ -391,6 +430,7 @@ class AttractionDetailsView extends StatelessWidget { faqBox( "About this place", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. A id diam nisl, non justo, in odio...", + () {}, ), SizedBox(height: 15.h), @@ -398,12 +438,19 @@ class AttractionDetailsView extends StatelessWidget { faqBox( "Term and condition", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. A id diam nisl, non justo, in odio...", + () { + Navigator.pushNamed( + context, + RouteConstants.termsAndCondition, + ); + }, ), SizedBox(height: 15.h), faqBox( "Cancellation Policy", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. A id diam nisl, non justo, in odio...", + () {}, ), ], ), @@ -431,6 +478,7 @@ class AttractionDetailsView extends StatelessWidget { Image.asset(icon, scale: 4), SizedBox(width: 16.w), Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ CustomText( text: title, @@ -453,31 +501,34 @@ class AttractionDetailsView extends StatelessWidget { ); } - Widget faqBox(String title, String desc) { - return Container( - padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 12.h), - decoration: BoxDecoration( - color: Color(0xFFFFF5F5), - border: Border.all(color: Color(0xFFFDCDCE)), - borderRadius: BorderRadius.circular(10.r), - ), - child: Column( - children: [ - Row( - children: [ - CustomText( - text: title, - size: 16.sp, - weight: FontWeight.w500, - color: Color(0xFF212121), - ), - SizedBox(width: 20.w), - Icon(Icons.arrow_forward_ios_outlined, size: 18.sp), - ], - ), - SizedBox(height: 9.h), - CustomText(text: desc, size: 11.sp, color: Color(0xFF7D7D7D)), - ], + Widget faqBox(String title, String desc, Function() onTap) { + return GestureDetector( + onTap: onTap, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 12.h), + decoration: BoxDecoration( + color: Color(0xFFFFF5F5), + border: Border.all(color: Color(0xFFFDCDCE)), + borderRadius: BorderRadius.circular(10.r), + ), + child: Column( + children: [ + Row( + children: [ + CustomText( + text: title, + size: 16.sp, + weight: FontWeight.w500, + color: Color(0xFF212121), + ), + SizedBox(width: 20.w), + Icon(Icons.arrow_forward_ios_outlined, size: 18.sp), + ], + ), + SizedBox(height: 9.h), + CustomText(text: desc, size: 11.sp, color: Color(0xFF7D7D7D)), + ], + ), ), ); } diff --git a/pubspec.lock b/pubspec.lock index 41ae5ce..8e12fcc 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -906,6 +906,70 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.2" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8 + url: "https://pub.dev" + source: hosted + version: "6.3.2" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "5c8b6c2d89a78f5a1cca70a73d9d5f86c701b36b42f9c9dac7bad592113c28e9" + url: "https://pub.dev" + source: hosted + version: "6.3.24" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "6b63f1441e4f653ae799166a72b50b1767321ecc263a57aadf825a7a2a5477d9" + url: "https://pub.dev" + source: hosted + version: "6.3.5" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "8262208506252a3ed4ff5c0dc1e973d2c0e0ef337d0a074d35634da5d44397c9" + url: "https://pub.dev" + source: hosted + version: "3.2.4" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + url: "https://pub.dev" + source: hosted + version: "3.1.4" uuid: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 3d49d78..04c7df5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,6 +51,7 @@ dependencies: video_player: ^2.10.0 lottie: ^3.3.2 flutter_native_splash: ^2.4.7 + url_launcher: ^6.3.2 dev_dependencies: flutter_test: