|
|
|
|
@ -30,28 +30,18 @@ class NewHomeHealthCareStepTowPage extends StatefulWidget {
|
|
|
|
|
final Function(PickResult)? onPick;
|
|
|
|
|
final double? latitude;
|
|
|
|
|
final double? longitude;
|
|
|
|
|
final PatientERInsertPresOrderRequestModel?
|
|
|
|
|
patientERInsertPresOrderRequestModel;
|
|
|
|
|
final PatientERInsertPresOrderRequestModel? patientERInsertPresOrderRequestModel;
|
|
|
|
|
final Function? changePageViewIndex;
|
|
|
|
|
final HomeHealthCareViewModel model;
|
|
|
|
|
|
|
|
|
|
const NewHomeHealthCareStepTowPage(
|
|
|
|
|
{Key? key,
|
|
|
|
|
this.onPick,
|
|
|
|
|
this.latitude,
|
|
|
|
|
this.longitude,
|
|
|
|
|
this.patientERInsertPresOrderRequestModel,
|
|
|
|
|
this.changePageViewIndex,
|
|
|
|
|
required this.model})
|
|
|
|
|
const NewHomeHealthCareStepTowPage({Key? key, this.onPick, this.latitude, this.longitude, this.patientERInsertPresOrderRequestModel, this.changePageViewIndex, required this.model})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_NewHomeHealthCareStepTowPageState createState() =>
|
|
|
|
|
_NewHomeHealthCareStepTowPageState();
|
|
|
|
|
_NewHomeHealthCareStepTowPageState createState() => _NewHomeHealthCareStepTowPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _NewHomeHealthCareStepTowPageState
|
|
|
|
|
extends State<NewHomeHealthCareStepTowPage> {
|
|
|
|
|
class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowPage> {
|
|
|
|
|
double latitude = 0;
|
|
|
|
|
double longitude = 0;
|
|
|
|
|
AddressInfo? _selectedAddress;
|
|
|
|
|
@ -88,8 +78,7 @@ class _NewHomeHealthCareStepTowPageState
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _getUserLocation() async {
|
|
|
|
|
if (await this.sharedPref.getDouble(USER_LAT) != null &&
|
|
|
|
|
await this.sharedPref.getDouble(USER_LONG) != null) {
|
|
|
|
|
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);
|
|
|
|
|
latitude = lat;
|
|
|
|
|
@ -97,8 +86,7 @@ class _NewHomeHealthCareStepTowPageState
|
|
|
|
|
currentPostion = LatLng(lat, long);
|
|
|
|
|
setMap();
|
|
|
|
|
} else {
|
|
|
|
|
locationUtils =
|
|
|
|
|
new LocationUtils(isShowConfirmDialog: true, context: context);
|
|
|
|
|
locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context);
|
|
|
|
|
locationUtils.getCurrentLocation(callBack: (value) {
|
|
|
|
|
print(value);
|
|
|
|
|
setMap();
|
|
|
|
|
@ -138,8 +126,7 @@ class _NewHomeHealthCareStepTowPageState
|
|
|
|
|
showCurrentLocation = true;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
latLong = widget
|
|
|
|
|
.model.addressesList[widget.model.addressesList.length - 1].latLong;
|
|
|
|
|
latLong = widget.model.addressesList[widget.model.addressesList.length - 1].latLong;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -178,8 +165,7 @@ class _NewHomeHealthCareStepTowPageState
|
|
|
|
|
decoration: cardRadius(12),
|
|
|
|
|
child: Container(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () =>
|
|
|
|
|
confirmSelectLocationDialog(widget.model.addressesList),
|
|
|
|
|
onTap: () => confirmSelectLocationDialog(widget.model.addressesList),
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(8),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
@ -212,28 +198,28 @@ class _NewHomeHealthCareStepTowPageState
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: LocationPage(
|
|
|
|
|
// latitude: latitude,
|
|
|
|
|
// longitude: longitude,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
).then((value) async {
|
|
|
|
|
print(value);
|
|
|
|
|
await widget.model.getCustomerAddresses();
|
|
|
|
|
setState(() {});
|
|
|
|
|
});
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// FadePage(
|
|
|
|
|
// page: LocationPage(
|
|
|
|
|
// // latitude: latitude,
|
|
|
|
|
// // longitude: longitude,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ).then((value) async {
|
|
|
|
|
// print(value);
|
|
|
|
|
// await widget.model.getCustomerAddresses();
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// });
|
|
|
|
|
},
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8),
|
|
|
|
|
padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 16),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Icon(Icons.add_circle_outline_sharp),
|
|
|
|
|
Icon(Icons.location_on_outlined),
|
|
|
|
|
mWidth(12),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).addNewAddress,
|
|
|
|
|
TranslationBase.of(context).selectLocation,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
@ -261,23 +247,18 @@ class _NewHomeHealthCareStepTowPageState
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14),
|
|
|
|
|
padding: const EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14),
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
TranslationBase.of(context).continues,
|
|
|
|
|
() {
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.patientERInsertPresOrderRequestModel!.latitude =
|
|
|
|
|
latitude;
|
|
|
|
|
widget.patientERInsertPresOrderRequestModel!.longitude =
|
|
|
|
|
longitude;
|
|
|
|
|
widget.patientERInsertPresOrderRequestModel!.latitude = latitude;
|
|
|
|
|
widget.patientERInsertPresOrderRequestModel!.longitude = longitude;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
navigateTo(
|
|
|
|
|
context,
|
|
|
|
|
NewHomeHealthCareStepThreePage(
|
|
|
|
|
patientERInsertPresOrderRequestModel:
|
|
|
|
|
widget.patientERInsertPresOrderRequestModel,
|
|
|
|
|
patientERInsertPresOrderRequestModel: widget.patientERInsertPresOrderRequestModel,
|
|
|
|
|
model: widget.model,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -319,8 +300,7 @@ class _NewHomeHealthCareStepTowPageState
|
|
|
|
|
|
|
|
|
|
goToCurrentLocation() {
|
|
|
|
|
Geolocator.getCurrentPosition().then((value) {
|
|
|
|
|
_selectedAddress =
|
|
|
|
|
AddressInfo(latLong: '${value.latitude},${value.longitude}');
|
|
|
|
|
_selectedAddress = AddressInfo(latLong: '${value.latitude},${value.longitude}');
|
|
|
|
|
moveToLocation(LatLng(value.latitude, value.longitude));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|