|
|
|
|
@ -1,19 +1,18 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/location_util.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
@ -45,6 +44,7 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
|
|
|
|
|
double longitude = 0;
|
|
|
|
|
AddressInfo _selectedAddress;
|
|
|
|
|
bool showCurrentLocation = false;
|
|
|
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
|
|
|
|
|
|
Completer<GoogleMapController> _controller = Completer();
|
|
|
|
|
GoogleMapController googleMapController;
|
|
|
|
|
@ -56,21 +56,25 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
|
|
|
|
|
LatLng currentPostion;
|
|
|
|
|
|
|
|
|
|
void _getUserLocation() async {
|
|
|
|
|
if (await Permission.contacts.request().isGranted) {
|
|
|
|
|
// Either the permission was already granted before or the user just granted it.
|
|
|
|
|
var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
|
|
|
|
|
|
|
|
|
|
currentPostion = LatLng(position.latitude, position.longitude);
|
|
|
|
|
if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) {
|
|
|
|
|
var lat = await this.sharedPref.getDouble(USER_LAT);
|
|
|
|
|
var long = await this.sharedPref.getDouble(USER_LONG);
|
|
|
|
|
currentPostion = LatLng(lat, long);
|
|
|
|
|
setMap();
|
|
|
|
|
} else {
|
|
|
|
|
requestPermissions().then((value) async {
|
|
|
|
|
if (value[Permission.location].isGranted) {
|
|
|
|
|
var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
|
|
|
|
|
|
|
|
|
|
currentPostion = LatLng(position.latitude, position.longitude);
|
|
|
|
|
setMap();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (await Permission.location.request().isGranted) {
|
|
|
|
|
var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
|
|
|
|
|
currentPostion = LatLng(position.latitude, position.longitude);
|
|
|
|
|
setMap();
|
|
|
|
|
} else {
|
|
|
|
|
requestPermissions().then((value) async {
|
|
|
|
|
if (value[Permission.location].isGranted) {
|
|
|
|
|
var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
|
|
|
|
|
currentPostion = LatLng(position.latitude, position.longitude);
|
|
|
|
|
setMap();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -90,7 +94,7 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
|
|
|
|
|
CameraUpdate.newCameraPosition(
|
|
|
|
|
CameraPosition(
|
|
|
|
|
target: currentPostion,
|
|
|
|
|
zoom: 20,
|
|
|
|
|
zoom: 16,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -122,6 +126,7 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
|
|
|
|
|
|
|
|
|
|
latitude = double.parse(latLongArr[0]);
|
|
|
|
|
longitude = double.parse(latLongArr[1]);
|
|
|
|
|
currentPostion = LatLng(latitude, longitude);
|
|
|
|
|
setMap();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|