Update: 2026-06-11 13:47:39

This commit is contained in:
Hamza-Ayed
2026-06-11 13:47:40 +03:00
parent 977adfe99d
commit c5170a88d2
516 changed files with 3654 additions and 3321 deletions

View File

@@ -846,6 +846,7 @@ class RideLifecycleController extends GetxController {
rideIsBeginPassengerTimer();
runWhenRideIsBegin();
_updatePassengerWalkLine();
update();
}
@@ -1730,7 +1731,7 @@ class RideLifecycleController extends GetxController {
String generateTrackingLink(String rideId, String driverId) {
String cleanRideId = rideId.toString().trim();
String cleanDriverId = driverId.toString().trim();
const String secretSalt = "Intaleq_Secure_Track_2025";
const String secretSalt = "Siro_Secure_Track_2025";
String rawString = "$cleanRideId$cleanDriverId$secretSalt";
var bytes = utf8.encode(rawString);
@@ -2260,6 +2261,7 @@ class RideLifecycleController extends GetxController {
}
mapEngine.fitCameraToPoints(driverPos, passengerPos);
_updatePassengerWalkLine();
update();
}
} catch (e) {
@@ -2386,6 +2388,7 @@ class RideLifecycleController extends GetxController {
),
};
}
_updatePassengerWalkLine();
update();
}
}
@@ -3508,9 +3511,29 @@ class RideLifecycleController extends GetxController {
LatLngBounds boundsObj =
LatLngBounds(northeast: northeastBound, southwest: southwestBound);
var cameraUpdate = CameraUpdate.newLatLngBounds(boundsObj,
left: 180, top: 180, right: 180, bottom: 180);
mapController!.animateCamera(cameraUpdate);
final latDiff = (northeastBound.latitude - southwestBound.latitude).abs();
final lngDiff = (northeastBound.longitude - southwestBound.longitude).abs();
if (latDiff < 0.0001 || lngDiff < 0.0001) {
final center = LatLng(
(northeastBound.latitude + southwestBound.latitude) / 2,
(northeastBound.longitude + southwestBound.longitude) / 2,
);
mapController!.animateCamera(CameraUpdate.newLatLngZoom(center, 17));
} else {
try {
var cameraUpdate = CameraUpdate.newLatLngBounds(boundsObj,
left: 180, top: 180, right: 180, bottom: 180);
mapController!.animateCamera(cameraUpdate);
} catch (e) {
final center = LatLng(
(northeastBound.latitude + southwestBound.latitude) / 2,
(northeastBound.longitude + southwestBound.longitude) / 2,
);
mapController!.animateCamera(CameraUpdate.newLatLngZoom(center, 17));
}
}
update();
}
@@ -4562,4 +4585,82 @@ class RideLifecycleController extends GetxController {
sinLng;
return 2 * R * atan2(pow(h, 0.5).toDouble(), pow(1 - h, 0.5).toDouble());
}
// دالة لبناء الخط المنقط
List<Polyline> _buildDashedLine(LatLng start, LatLng end,
{required Color color, required String prefixId}) {
List<Polyline> segments = [];
double dist = Geolocator.distanceBetween(
start.latitude, start.longitude, end.latitude, end.longitude);
const double dashLengthMeters = 8.0;
const double gapLengthMeters = 6.0;
double latDiff = end.latitude - start.latitude;
double lngDiff = end.longitude - start.longitude;
double totalLength = 0;
int segmentCount = 0;
while (totalLength < dist) {
double startFraction = totalLength / dist;
double endFraction = (totalLength + dashLengthMeters) / dist;
if (endFraction > 1.0) {
endFraction = 1.0;
}
double startLat = start.latitude + latDiff * startFraction;
double startLng = start.longitude + lngDiff * startFraction;
double endLat = start.latitude + latDiff * endFraction;
double endLng = start.longitude + lngDiff * endFraction;
segments.add(
Polyline(
polylineId: PolylineId('${prefixId}_dash_$segmentCount'),
points: [LatLng(startLat, startLng), LatLng(endLat, endLng)],
color: color,
width: 4,
),
);
segmentCount++;
totalLength += dashLengthMeters + gapLengthMeters;
}
return segments;
}
// تحديث الخط المنقط ومكان أيقونة المشي للراكب
void _updatePassengerWalkLine() {
polyLines.removeWhere(
(p) => p.polylineId.value.startsWith('passenger_walk_line'));
markers.removeWhere((m) => m.markerId.value == 'walk_end_marker');
bool shouldShowWalkPath =
(statusRide == 'Apply' || statusRide == 'Arrived') &&
_currentDriverRoutePoints.isNotEmpty &&
passengerLocation.latitude != 0;
if (shouldShowWalkPath) {
final LatLng lastRoadPt = _currentDriverRoutePoints.last;
final walkDashes = _buildDashedLine(
lastRoadPt,
passengerLocation,
color: Colors.blueGrey,
prefixId: 'passenger_walk_line',
);
polyLines.addAll(walkDashes);
markers.add(
Marker(
markerId: const MarkerId('walk_end_marker'),
position: lastRoadPt,
icon: InlqBitmap.fromStyleImage('walk_icon'),
anchor: const Offset(0.5, 0.5),
),
);
}
mapEngine.update();
update();
}
}