fix issues PAP-910,PAP-911

merge-requests/376/head
Elham Rababh 3 years ago
parent 36142f0f6d
commit 2e2f7334d5

@ -33,11 +33,15 @@ class CMCLocationPage extends StatefulWidget {
class _CMCLocationPageState extends State<CMCLocationPage> {
double latitude = 0;
double longitude = 0;
bool showCurrentLocation = false;
@override
void initState() {
latitude = widget.latitude;
longitude = widget.longitude;
if(latitude == 0.0 && longitude == 0.0) {
showCurrentLocation = true;
}
super.initState();
}
@ -149,7 +153,7 @@ class _CMCLocationPageState extends State<CMCLocationPage> {
);
},
initialPosition: LatLng(latitude, longitude),
useCurrentLocation: false,
useCurrentLocation: showCurrentLocation,
),
));
}

@ -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),

@ -33,12 +33,16 @@ class _LocationPageState
extends State<LocationPage> {
double latitude = 0;
double longitude = 0;
bool showCurrentLocation = false;
@override
void initState() {
latitude = widget.latitude;
longitude = widget.longitude;
if(latitude == 0.0 && longitude == 0.0) {
showCurrentLocation = true;
}
super.initState();
}
@ -141,7 +145,7 @@ class _LocationPageState
);
},
initialPosition: LatLng(latitude, longitude),
useCurrentLocation: false,
useCurrentLocation: showCurrentLocation,
),
));
}

@ -46,6 +46,8 @@ class _NewHomeHealthCareStepTowPageState
double latitude = 0;
double longitude = 0;
AddressInfo _selectedAddress;
bool showCurrentLocation = false;
@override
void initState() {
@ -60,13 +62,25 @@ class _NewHomeHealthCareStepTowPageState
}
setLatitudeAndLongitude({bool isSetState = false, String latLong}) {
if (latLong == null)
latLong = widget.model.addressesList[widget.model.addressesList
.length - 1].latLong;
List latLongArr = latLong.split(',');
if (latLong == null){
if(widget.model.addressesList.isEmpty) {
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]);
}
latitude = double.parse(latLongArr[0]);
longitude = double.parse(latLongArr[1]);
}
@override
@ -147,8 +161,9 @@ class _NewHomeHealthCareStepTowPageState
);
},
initialPosition: LatLng(latitude, longitude),
useCurrentLocation: false,
useCurrentLocation: showCurrentLocation,
),
if(widget.model.addressesList.isNotEmpty)
Container(
child: InkWell(
onTap: () =>

Loading…
Cancel
Save