Untitled
unknown
plain_text
8 months ago
1.0 kB
0
Indexable
Never
import 'package:bjbs/widgets/others/show_dialog.dart'; import 'package:geolocator/geolocator.dart'; import 'package:get/get.dart'; import 'package:permission_handler/permission_handler.dart'; class GetLocation { Future<String> getLatlong() async { final locationStatus = await Permission.location.request(); if (locationStatus.isGranted) { final location = await Geolocator.getCurrentPosition(); return '${location.latitude}, ${location.longitude}'; } else if (locationStatus.isPermanentlyDenied || locationStatus.isRestricted) { showPopUpInfo( title: 'information'.tr, description: 'Silakan akses pengaturan dan aktifkan lokasi pada perangkat anda untuk melanjutkan proses login', labelButton: 'understand'.tr, dismissible: false, onPress: () async { Get.back(); // await openAppSettings(); }, ); return ''; } else { showToast(message: 'denied_location'.tr); return ''; } } }
Leave a Comment