|
|
|
@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/Comprehens
|
|
|
|
|
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/uitl/location_util.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';
|
|
|
|
@ -44,6 +45,7 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
|
|
|
|
|
double latitude = 0;
|
|
|
|
|
double longitude = 0;
|
|
|
|
|
AddressInfo _selectedAddress;
|
|
|
|
|
bool showCurrentLocation = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
@ -56,14 +58,26 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setLatitudeAndLongitude({bool isSetState = false, String latLong}) {
|
|
|
|
|
if (latLong == null)
|
|
|
|
|
latLong = widget
|
|
|
|
|
.model.addressesList[widget.model.addressesList.length - 1].latLong;
|
|
|
|
|
List latLongArr = latLong.split(',');
|
|
|
|
|
setLatitudeAndLongitude({bool isSetState = false, String latLong}) async {
|
|
|
|
|
if (latLong == null){
|
|
|
|
|
if(widget.model.addressesList.isEmpty) {
|
|
|
|
|
|
|
|
|
|
latitude = double.parse(latLongArr[0]);
|
|
|
|
|
longitude = double.parse(latLongArr[1]);
|
|
|
|
|
setState(() {
|
|
|
|
|
showCurrentLocation = true;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
latLong = widget
|
|
|
|
|
.model.addressesList[widget.model.addressesList.length - 1].latLong;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!showCurrentLocation) {
|
|
|
|
|
List latLongArr = latLong.split(',');
|
|
|
|
|
|
|
|
|
|
latitude = double.parse(latLongArr[0]);
|
|
|
|
|
longitude = double.parse(latLongArr[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@ -144,9 +158,11 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
initialPosition: LatLng(latitude, longitude),
|
|
|
|
|
useCurrentLocation: false,
|
|
|
|
|
useCurrentLocation: showCurrentLocation,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
if(widget.model.addressesList.isNotEmpty)
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () =>
|
|
|
|
|
confirmSelectLocationDialog(widget.model.addressesList),
|
|
|
|
|