bug fixes

merge-update-with-lab-changes
Sultan Khan 4 years ago
parent a4ab22a4aa
commit 5fe0214e04

@ -12,8 +12,8 @@ const PACKAGES_PRODUCTS = '/api/products';
const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders';
const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs
// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';

@ -17,8 +17,9 @@ import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/widgets/app_map/google_huawei_map.dart';
import 'location_page.dart';
import 'package:geolocator/geolocator.dart';
class NewHomeHealthCareStepTowPage extends StatefulWidget {
final Function(PickResult) onPick;
@ -39,35 +40,47 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
double longitude = 0;
AddressInfo _selectedAddress;
bool showCurrentLocation = false;
Completer<GoogleMapController> _controller = Completer();
GoogleMapController googleMapController;
final Set<Marker> markers = new Set();
AppMap appMap;
static CameraPosition _kGooglePlex = CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
zoom: 14.4746,
);
LatLng currentPostion;
Completer<GoogleMapController> mapController = Completer();
@override
void initState() {
if (widget.patientERInsertPresOrderRequestModel.latitude == null) {
setLatitudeAndLongitude();
} else {
latitude = widget.patientERInsertPresOrderRequestModel.latitude;
longitude = widget.patientERInsertPresOrderRequestModel.longitude;
}
markers.clear();
markers.add(
Marker(
markerId: MarkerId(
latitude.hashCode.toString(),
),
position: LatLng(latitude, longitude)),
appMap = AppMap(
_kGooglePlex.toMap(),
onCameraMove: (camera) {
_updatePosition(camera);
},
onMapCreated: () {
goToCurrentLocation();
setState(() {});
},
);
// if (widget.patientERInsertPresOrderRequestModel.latitude == null) {
// setLatitudeAndLongitude();
// } else {
// latitude = widget.patientERInsertPresOrderRequestModel.latitude;
// longitude = widget.patientERInsertPresOrderRequestModel.longitude;
// }
// markers.clear();
// markers.add(
// Marker(
// markerId: MarkerId(
// latitude.hashCode.toString(),
// ),
// position: LatLng(latitude, longitude)),
// );
// _kGooglePlex = CameraPosition(
// target: LatLng(latitude, longitude),
// zoom: 14.4746,
// );
_kGooglePlex = CameraPosition(
target: LatLng(latitude, longitude),
zoom: 14.4746,
);
super.initState();
}
@ -87,9 +100,21 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
latitude = double.parse(latLongArr[0]);
longitude = double.parse(latLongArr[1]);
currentPostion = LatLng(latitude, longitude);
setMap();
}
}
setMap() {
setState(() {
_kGooglePlex = CameraPosition(
target: currentPostion,
zoom: 14.4746,
);
appMap.moveTo(cameraPostion: _kGooglePlex);
});
}
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
@ -168,22 +193,35 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
),
),
),
// Expanded(
// child: Stack(
// alignment: Alignment.center,
// children: [
// GoogleMap(
// mapType: MapType.normal,
// zoomControlsEnabled: false,
// myLocationButtonEnabled: true,
// myLocationEnabled: true,
// initialCameraPosition: _kGooglePlex,
// onCameraMove: ((_position) => _updatePosition(_position)),
// onMapCreated: (GoogleMapController controller) {
// googleMapController = controller;
// _controller.complete(controller);
// },
// ),
// Icon(
// Icons.place,
// color: CustomColors.accentColor,
// size: 50,
// ),
// ],
// ),
// ),
Expanded(
child: Stack(
alignment: Alignment.center,
children: [
GoogleMap(
mapType: MapType.normal,
zoomControlsEnabled: false,
myLocationButtonEnabled: true,
myLocationEnabled: true,
initialCameraPosition: _kGooglePlex,
onCameraMove: ((_position) => _updatePosition(_position)),
onMapCreated: (GoogleMapController controller) {
googleMapController = controller;
_controller.complete(controller);
},
),
if (appMap != null) appMap,
Icon(
Icons.place,
color: CustomColors.accentColor,
@ -246,4 +284,27 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
else
return TranslationBase.of(context).selectAddress;
}
goToCurrentLocation() {
Geolocator.getCurrentPosition().then((value) {
_selectedAddress = AddressInfo(latLong: '${value.latitude},${value.longitude}');
moveToLocation(LatLng(value.latitude, value.longitude));
});
}
moveToLocation(LatLng location, {bool animate = true}) async {
await Future.delayed(Duration(milliseconds: 200));
_kGooglePlex = CameraPosition(
target: location,
zoom: 16.4746,
);
if (animate)
(await mapController.future).animateCamera(
CameraUpdate.newCameraPosition(_kGooglePlex),
);
else
(await mapController.future).moveCamera(
CameraUpdate.newCameraPosition(_kGooglePlex),
);
}
}

@ -60,9 +60,19 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
bool showCurrentLocation = false;
@override
void initState() {
goToCurrentLocation();
super.initState();
appMap = AppMap(
cameraPosition.toMap(),
onCameraMove: (camera) {
_updatePosition(camera);
},
onMapCreated: () {
goToCurrentLocation();
setState(() {});
},
);
// addressStream = addressStreamController.stream;
// addressLoadingStream = addressLoadingStreamController.stream;
}
@ -203,9 +213,7 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
child: Stack(
alignment: Alignment.center,
children: [
appMap = AppMap(cameraPosition.toMap(), onCameraMove: (camera) {
_updatePosition(camera);
}),
if (appMap != null) appMap,
Icon(
Icons.place,
color: CustomColors.accentColor,

@ -62,12 +62,12 @@ class _SchedulePageState extends State<SchedulePage> {
onModelReady: (model2) => model2.getFreeSlots(doctorList),
allowAny: true,
builder: (_, model2, widget2) {
if (model.freeSlots.length > 0 && isPageChange == false && model.state == ViewState.Idle) {
this.freeSlots = model.freeSlots;
if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) {
this.freeSlots = model2.freeSlots;
this.doctorScheduleResponse = model.getDoctorScheduleList;
this.generateWeeksSchedules();
} else if (model.freeSlots.length == 0 && model.state == ViewState.Idle) {
} else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) {
AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule);
Navigator.pop(context);
}

Loading…
Cancel
Save