import 'package:get/get.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../common/widgets/toast.dart'; class UrlLauncherService { /// ----------------send email --------------/// static Future sendEmail(String email) async { final Uri url = Uri( scheme: 'mailto', path: email, ); if (await canLaunchUrl(url)) { await launchUrl(url); } else { Toast.showToast('could_not_send_email'.tr); } } /// ------make call-------------- /// static Future makePhoneCall(String phoneNumber) async { Uri callUrl = Uri(scheme: 'tel', path: phoneNumber); if (await canLaunchUrl(callUrl)) { await launchUrl(callUrl); } else { Toast.showToast('could_not_make_call'.tr); } } static Future sendWhatsapp(String phoneNumber) async { // String phone = "+963 940903459"; String androidUrl = "whatsapp://send?phone=$phoneNumber&text=Hi, I need some help"; try { await launchUrl(Uri.parse(androidUrl)); } on Exception { Toast.showToast("WhatsApp is not installed."); } } }