|
|
|
@ -1,16 +1,20 @@
|
|
|
|
import 'dart:io';
|
|
|
|
import 'dart:io';
|
|
|
|
import 'dart:ui';
|
|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:geolocator/geolocator.dart';
|
|
|
|
import 'package:geolocator/geolocator.dart';
|
|
|
|
import 'package:gms_check/gms_check.dart';
|
|
|
|
import 'package:gms_check/gms_check.dart';
|
|
|
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
|
|
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/app_state.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/app_state.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/cache_consts.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/cache_consts.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
|
|
|
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
|
|
|
import 'package:huawei_location/huawei_location.dart' as HmsLocation show FusedLocationProviderClient, Location, LocationSettingsRequest, LocationRequest;
|
|
|
|
import 'package:huawei_location/huawei_location.dart' as HmsLocation show FusedLocationProviderClient, Location, LocationSettingsRequest, LocationRequest;
|
|
|
|
import 'package:location/location.dart' show Location, PermissionStatus, LocationData;
|
|
|
|
import 'package:location/location.dart' show Location, PermissionStatus, LocationData;
|
|
|
|
import 'package:permission_handler/permission_handler.dart' show Permission, PermissionListActions, PermissionStatusGetters;
|
|
|
|
import 'package:permission_handler/permission_handler.dart' show Permission, PermissionListActions, PermissionStatusGetters, openAppSettings;
|
|
|
|
|
|
|
|
|
|
|
|
class LocationUtils {
|
|
|
|
class LocationUtils {
|
|
|
|
NavigationService navigationService;
|
|
|
|
NavigationService navigationService;
|
|
|
|
@ -68,6 +72,26 @@ class LocationUtils {
|
|
|
|
onFailure?.call();
|
|
|
|
onFailure?.call();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (permissionGranted == LocationPermission.deniedForever) {
|
|
|
|
|
|
|
|
if (isShowConfirmDialog) {
|
|
|
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
|
|
|
title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!),
|
|
|
|
|
|
|
|
navigationService.navigatorKey.currentContext!,
|
|
|
|
|
|
|
|
child: Utils.getWarningWidget(
|
|
|
|
|
|
|
|
loadingText: "Please grant location permission from app settings to see the nearest ER location details".needTranslation,
|
|
|
|
|
|
|
|
isShowActionButtons: true,
|
|
|
|
|
|
|
|
onCancelTap: () {
|
|
|
|
|
|
|
|
navigationService.pop();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onConfirmTap: () async {
|
|
|
|
|
|
|
|
navigationService.pop();
|
|
|
|
|
|
|
|
openAppSettings();
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Position? currentLocation = await Geolocator.getLastKnownPosition();
|
|
|
|
Position? currentLocation = await Geolocator.getLastKnownPosition();
|
|
|
|
|