This commit is contained in:
Hamza-Ayed
2023-08-07 21:28:13 +03:00
parent 73b915b880
commit 766354ac99
3 changed files with 81 additions and 26 deletions

View File

@@ -43,7 +43,8 @@ class MapController extends GetxController {
Future getPlaces() async {
var url =
'${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${placeController.text}&location=32.111946,${mylocation.longitude}&radius=10000&type=restaurant&language=ar&key=${AppCredintials.mapAPIKEY}';
// '${AppLink.googleMapsLink}place/nearbysearch/json?location=${mylocation.longitude}&radius=25000&language=ar&keyword=&key=${placeController.text}${AppCredintials.mapAPIKEY}';
'${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${placeController.text}&location=32.111946,${mylocation.longitude}&radius=10000&language=ar&key=${AppCredintials.mapAPIKEY}';
var response = await CRUD().getGoogleApi(link: url, payload: {});
@@ -107,7 +108,7 @@ class MapController extends GetxController {
(_locationData.latitude != null && _locationData.longitude != null
? LatLng(_locationData.latitude!, _locationData.longitude!)
: null)!;
print(_locationData.accuracy);
print('accuracy' + _locationData.accuracy.toString());
print(_locationData.latitude);
print(_locationData.time);
print('//////////////////////////////////////');
@@ -118,9 +119,9 @@ class MapController extends GetxController {
void onMapCreated(GoogleMapController controller) {
mapController = controller;
controller.getVisibleRegion();
// controller.animateCamera(
// CameraUpdate.newLatLng(mylocation),
// );
controller.animateCamera(
CameraUpdate.newLatLng(mylocation),
);
update();
}
@@ -163,14 +164,16 @@ class MapController extends GetxController {
getDistanceFromText(data[0]['distance']['text']);
// Animate the camera to the adjusted bounds
if (distanceOfDestnation > 16 && distanceOfDestnation < 30) {
if (distanceOfDestnation <= 10) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(mylocation, 14));
} else if (distanceOfDestnation > 10 && distanceOfDestnation < 16) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(mylocation, 12));
} else if (distanceOfDestnation > 16 && distanceOfDestnation < 30) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(mylocation, 10));
} else if (distanceOfDestnation > 30 && distanceOfDestnation < 100) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(mylocation, 8));
} else if (distanceOfDestnation > 100) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(mylocation, 6));
} else {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(mylocation, 11));
}
if (polylines.isNotEmpty) {
clearpolyline();