taafee-mobile/lib/core/url launcher/url_launcher_service.dart
2023-10-17 17:22:55 +03:00

31 lines
763 B
Dart

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);
}
}
}