24-12/26/1
This commit is contained in:
@@ -575,7 +575,7 @@ class MapPassengerController extends GetxController {
|
||||
void getDrawerMenu() {
|
||||
heightMenuBool = !heightMenuBool;
|
||||
widthMapTypeAndTraffic = heightMenuBool == true ? 0 : 50;
|
||||
heightMenu = heightMenuBool == true ? 70 : 0;
|
||||
heightMenu = heightMenuBool == true ? 80 : 0;
|
||||
widthMenu = heightMenuBool == true ? 110 : 0;
|
||||
update();
|
||||
}
|
||||
@@ -3160,7 +3160,7 @@ class MapPassengerController extends GetxController {
|
||||
} else {
|
||||
isMainBottomMenuMap = !isMainBottomMenuMap;
|
||||
mainBottomMenuMapHeight =
|
||||
isMainBottomMenuMap == true ? Get.height * .2 : Get.height * .55;
|
||||
isMainBottomMenuMap == true ? Get.height * .2 : Get.height * .7;
|
||||
isWayPointSheet = false;
|
||||
if (heightMenuBool == true) {
|
||||
getDrawerMenu();
|
||||
@@ -4074,7 +4074,7 @@ class MapPassengerController extends GetxController {
|
||||
LatLngBounds(northeast: northeast, southwest: southwest);
|
||||
|
||||
// Fit the camera to the bounds
|
||||
var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 100);
|
||||
var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 130);
|
||||
mapController!.animateCamera(cameraUpdate);
|
||||
|
||||
// getDistanceFromText(data[0]['distance']['text']);
|
||||
@@ -4132,117 +4132,51 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> _animatePolyline(List<LatLng> coordinates) async {
|
||||
// Initial animation
|
||||
polyLines.clear();
|
||||
List<LatLng> animatedPoints = [];
|
||||
const int totalAnimations = 7;
|
||||
|
||||
// Draw initial polyline
|
||||
for (int i = 0; i < coordinates.length; i++) {
|
||||
animatedPoints.add(coordinates[i]);
|
||||
polyLines.clear();
|
||||
polyLines.add(
|
||||
Polyline(
|
||||
polylineId: const PolylineId('animated_route'),
|
||||
points: List<LatLng>.from(animatedPoints),
|
||||
width: 4,
|
||||
color: AppColor.primaryColor,
|
||||
endCap: Cap.roundCap,
|
||||
startCap: Cap.roundCap,
|
||||
geodesic: true,
|
||||
),
|
||||
);
|
||||
|
||||
update();
|
||||
await Future.delayed(const Duration(milliseconds: 1));
|
||||
Color getAnimationColor(int cycle) {
|
||||
switch (cycle) {
|
||||
case 0:
|
||||
return AppColor.primaryColor;
|
||||
case 1:
|
||||
return AppColor.writeColor;
|
||||
case 2:
|
||||
return AppColor.primaryColor;
|
||||
default:
|
||||
return AppColor.primaryColor;
|
||||
}
|
||||
}
|
||||
|
||||
// Color change animations
|
||||
for (int cycle = 0; cycle < 6; cycle++) {
|
||||
// Change to green
|
||||
for (int cycle = 0; cycle < totalAnimations; cycle++) {
|
||||
polyLines.clear();
|
||||
polyLines.add(
|
||||
Polyline(
|
||||
polylineId: const PolylineId('animated_route'),
|
||||
points: coordinates,
|
||||
width: 4,
|
||||
color: AppColor.bronze,
|
||||
endCap: Cap.roundCap,
|
||||
startCap: Cap.roundCap,
|
||||
geodesic: true,
|
||||
),
|
||||
);
|
||||
update();
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
List<LatLng> animatedPoints = [];
|
||||
|
||||
// Change back to primary color
|
||||
polyLines.clear();
|
||||
polyLines.add(
|
||||
Polyline(
|
||||
polylineId: const PolylineId('animated_route'),
|
||||
points: coordinates,
|
||||
width: 4,
|
||||
color: AppColor.writeColor,
|
||||
endCap: Cap.roundCap,
|
||||
startCap: Cap.roundCap,
|
||||
geodesic: true,
|
||||
),
|
||||
);
|
||||
update();
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
for (int i = 0; i < coordinates.length; i++) {
|
||||
animatedPoints.add(coordinates[i]);
|
||||
polyLines.clear();
|
||||
polyLines.add(
|
||||
Polyline(
|
||||
polylineId: const PolylineId('animated_route'),
|
||||
points: List<LatLng>.from(animatedPoints),
|
||||
width: 4,
|
||||
color: getAnimationColor(cycle),
|
||||
endCap: Cap.roundCap,
|
||||
startCap: Cap.roundCap,
|
||||
geodesic: true,
|
||||
),
|
||||
);
|
||||
update();
|
||||
await Future.delayed(const Duration(milliseconds: 10));
|
||||
}
|
||||
|
||||
if (cycle < totalAnimations - 1) {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
polyLines.clear();
|
||||
update();
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add this method to your controller class
|
||||
// Future<void> _animatePolyline(List<LatLng> coordinates) async {
|
||||
// // Clear existing polylines
|
||||
// polyLines.clear();
|
||||
|
||||
// // Create segments for animation
|
||||
// List<LatLng> animatedPoints = [];
|
||||
|
||||
// // Calculate step size for smoother animation
|
||||
// int stepSize = (coordinates.length / 20).round();
|
||||
// stepSize = stepSize < 1 ? 1 : stepSize;
|
||||
|
||||
// for (int i = 0; i < coordinates.length; i += stepSize) {
|
||||
// // Add points gradually
|
||||
// animatedPoints.add(coordinates[i]);
|
||||
|
||||
// if (animatedPoints.length > 1) {
|
||||
// // Remove previous polyline
|
||||
// if (polyLines.isNotEmpty) {
|
||||
// polyLines.clear();
|
||||
// }
|
||||
// // Add new polyline segment
|
||||
// polyLines.add(
|
||||
// Polyline(
|
||||
// polylineId: const PolylineId('animated_route'),
|
||||
// points: List<LatLng>.from(animatedPoints),
|
||||
// width: 4,
|
||||
// color: Colors.blue,
|
||||
// ),
|
||||
// );
|
||||
|
||||
// // Update camera position to follow animation
|
||||
// if (mapController != null) {
|
||||
// final bounds = LatLngBounds(
|
||||
// southwest: animatedPoints.reduce((value, element) => LatLng(
|
||||
// min(value.latitude, element.latitude),
|
||||
// min(value.longitude, element.longitude))),
|
||||
// northeast: animatedPoints.reduce((value, element) => LatLng(
|
||||
// max(value.latitude, element.latitude),
|
||||
// max(value.longitude, element.longitude))),
|
||||
// );
|
||||
|
||||
// mapController!.animateCamera(
|
||||
// CameraUpdate.newLatLngBounds(bounds, 100),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// update();
|
||||
// await Future.delayed(const Duration(milliseconds: 50));
|
||||
// }
|
||||
// }
|
||||
|
||||
String shortenAddress(String fullAddress) {
|
||||
// Split the address into parts
|
||||
|
||||
Reference in New Issue
Block a user