9/19/2
This commit is contained in:
@@ -5,6 +5,10 @@ import 'package:flutter_overlay_window/flutter_overlay_window.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
import '../auth/captin/login_captin_controller.dart';
|
||||
|
||||
Future<void> getPermissionOverlay() async {
|
||||
if (Platform.isAndroid) {
|
||||
final bool status = await FlutterOverlayWindow.isPermissionGranted();
|
||||
@@ -23,17 +27,22 @@ Future<void> getPermissionOverlay() async {
|
||||
}
|
||||
|
||||
Future<void> getPermissionLocation() async {
|
||||
final PermissionStatus status = await Permission.location.request();
|
||||
if (status.isDenied) {
|
||||
MyDialog().getDialog(
|
||||
'Enable Location Permission'.tr, // {en:ar}
|
||||
'Allowing location access will help us display orders near you. Please enable it now.'
|
||||
.tr, // {en:ar}
|
||||
() async {
|
||||
Get.back();
|
||||
await FlutterOverlayWindow.requestPermission();
|
||||
},
|
||||
);
|
||||
final PermissionStatus status = await Permission.location.status;
|
||||
if (!status.isGranted) {
|
||||
// Log.print('status.isGranted: ${status.isGranted}');
|
||||
box.write(BoxName.locationPermission, 'true');
|
||||
await Permission.location.request();
|
||||
Get.find<LoginDriverController>().update();
|
||||
// MyDialog().getDialog(
|
||||
// 'Enable Location Permission'.tr, // {en:ar}
|
||||
// 'Allowing location access will help us display orders near you. Please enable it now.'
|
||||
// .tr, // {en:ar}
|
||||
// () async {
|
||||
// Get.back();
|
||||
// box.write(BoxName.locationPermission, 'true');
|
||||
// await Permission.location.request();
|
||||
// },
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user