pre map passenger splitting
This commit is contained in:
@@ -3015,6 +3015,23 @@ class MapPassengerController extends GetxController {
|
||||
Future<Map<String, double>?> extractCoordinatesFromLinkAsync(
|
||||
String link) async {
|
||||
try {
|
||||
// 1. معالجة روابط الخرائط المباشرة (geo: و google.navigation:)
|
||||
if (link.startsWith('geo:') || link.startsWith('google.navigation:')) {
|
||||
RegExp regex = RegExp(r'(-?\d+\.\d+)[,/~=](-?\d+\.\d+)');
|
||||
var match = regex.firstMatch(link);
|
||||
if (match != null) {
|
||||
double lat = double.parse(match.group(1)!);
|
||||
double lng = double.parse(match.group(2)!);
|
||||
if (lat > 40 && lat > lng) {
|
||||
double temp = lat;
|
||||
lat = lng;
|
||||
lng = temp;
|
||||
}
|
||||
return {'latitude': lat, 'longitude': lng};
|
||||
}
|
||||
}
|
||||
|
||||
// 2. معالجة الروابط العادية (http/https)
|
||||
int urlStartIndex = link.indexOf(RegExp(r'https?://'));
|
||||
if (urlStartIndex == -1) return null;
|
||||
String cleanLink = link.substring(urlStartIndex).trim();
|
||||
|
||||
Reference in New Issue
Block a user