2026-04-03-maplibra primary succsess

This commit is contained in:
Hamza-Ayed
2026-04-04 14:08:07 +03:00
parent e325405dff
commit 8d5fefc9e3
23 changed files with 2331 additions and 947 deletions

1801
assets/style.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -84,12 +84,6 @@ PODS:
- geolocator_apple (1.2.0):
- Flutter
- FlutterMacOS
- Google-Maps-iOS-Utils (6.1.3):
- GoogleMaps (~> 10.0)
- google_maps_flutter_ios (0.0.1):
- Flutter
- Google-Maps-iOS-Utils (< 7.0, >= 5.0)
- GoogleMaps (< 11.0, >= 8.4)
- google_sign_in_ios (0.0.1):
- Flutter
- FlutterMacOS
@@ -98,9 +92,6 @@ PODS:
- GoogleDataTransport (10.1.0):
- nanopb (~> 3.30910.0)
- PromisesObjC (~> 2.4)
- GoogleMaps (10.8.0):
- GoogleMaps/Maps (= 10.8.0)
- GoogleMaps/Maps (10.8.0)
- GoogleSignIn (9.1.0):
- AppAuth (~> 2.0)
- AppCheckCore (~> 11.0)
@@ -157,6 +148,10 @@ PODS:
- FlutterMacOS
- location (0.0.1):
- Flutter
- MapLibre (6.19.1)
- maplibre_gl (0.25.0):
- Flutter
- MapLibre (= 6.19.1)
- nanopb (3.30910.0):
- nanopb/decode (= 3.30910.0)
- nanopb/encode (= 3.30910.0)
@@ -268,7 +263,6 @@ DEPENDENCIES:
- flutter_secure_storage_darwin (from `.symlinks/plugins/flutter_secure_storage_darwin/darwin`)
- flutter_tts (from `.symlinks/plugins/flutter_tts/ios`)
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/darwin`)
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
- google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`)
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
@@ -277,6 +271,7 @@ DEPENDENCIES:
- live_activities (from `.symlinks/plugins/live_activities/ios`)
- local_auth_darwin (from `.symlinks/plugins/local_auth_darwin/darwin`)
- location (from `.symlinks/plugins/location/ios`)
- maplibre_gl (from `.symlinks/plugins/maplibre_gl/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- quick_actions_ios (from `.symlinks/plugins/quick_actions_ios/ios`)
@@ -304,14 +299,13 @@ SPEC REPOS:
- FirebaseCoreInternal
- FirebaseInstallations
- FirebaseMessaging
- Google-Maps-iOS-Utils
- GoogleDataTransport
- GoogleMaps
- GoogleSignIn
- GoogleUtilities
- GTMAppAuth
- GTMSessionFetcher
- IOSSecuritySuite
- MapLibre
- nanopb
- PromisesObjC
- RecaptchaInterop
@@ -355,8 +349,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_tts/ios"
geolocator_apple:
:path: ".symlinks/plugins/geolocator_apple/darwin"
google_maps_flutter_ios:
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"
google_sign_in_ios:
:path: ".symlinks/plugins/google_sign_in_ios/darwin"
image_cropper:
@@ -373,6 +365,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/local_auth_darwin/darwin"
location:
:path: ".symlinks/plugins/location/ios"
maplibre_gl:
:path: ".symlinks/plugins/maplibre_gl/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
permission_handler_apple:
@@ -426,11 +420,8 @@ SPEC CHECKSUMS:
flutter_secure_storage_darwin: acdb3f316ed05a3e68f856e0353b133eec373a23
flutter_tts: 35ac3c7d42412733e795ea96ad2d7e05d0a75113
geolocator_apple: ab36aa0e8b7d7a2d7639b3b4e48308394e8cef5e
Google-Maps-iOS-Utils: bed22fa703c919259b3901449434d60d994fae20
google_maps_flutter_ios: 0cf046caf50b00d95071f79e8031fcd5ef902beb
google_sign_in_ios: 000870aa06da9b28d1d0bf7ef70ff0213059dd28
GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7
GoogleMaps: fe4035acb768ed14ce732811363f232550ba55af
GoogleSignIn: fcee2257188d5eda57a5e2b6a715550ffff9206d
GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1
GTMAppAuth: 217a876b249c3c585a54fd6f73e6b58c4f5c4238
@@ -443,6 +434,8 @@ SPEC CHECKSUMS:
live_activities: 4dfa736d0736e1c77866a2f9c056a76513cc9e7b
local_auth_darwin: c3ee6cce0a8d56be34c8ccb66ba31f7f180aaebb
location: 155caecf9da4f280ab5fe4a55f94ceccfab838f8
MapLibre: 7f24faba45439f80ccb0f83393c29fa32cb81952
maplibre_gl: a2114567cbd1065866614fbd34dfb75ab782aaa2
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d

View File

@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 70;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -121,7 +121,7 @@
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
C663DBEB2F50907200D79908 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
C663DBEB2F50907200D79908 /* Exceptions for "RideWidget" folder in "RideWidgetExtension" target */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
Info.plist,
@@ -131,7 +131,18 @@
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
C663DBD82F50907000D79908 /* RideWidget */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (C663DBEB2F50907200D79908 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = RideWidget; sourceTree = "<group>"; };
C663DBD82F50907000D79908 /* RideWidget */ = {
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
C663DBEB2F50907200D79908 /* Exceptions for "RideWidget" folder in "RideWidgetExtension" target */,
);
explicitFileTypes = {
};
explicitFolders = (
);
path = RideWidget;
sourceTree = "<group>";
};
/* End PBXFileSystemSynchronizedRootGroup section */
/* Begin PBXFrameworksBuildPhase section */
@@ -295,6 +306,7 @@
C663DBE72F50907200D79908 /* Embed Foundation Extensions */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
9DE0D475D98797EEBEE003BD /* [CP] Copy Pods Resources */,
B77A6F719CDC97DC7270EA70 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -469,19 +481,32 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
B77A6F719CDC97DC7270EA70 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
C6C3FB403E5DB104310DE9A1 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;

View File

@@ -1,7 +1,6 @@
import UIKit
import Flutter
import FirebaseCore
import GoogleMaps
@main
@objc class AppDelegate: FlutterAppDelegate {
@@ -11,11 +10,7 @@ import GoogleMaps
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// --- 1. تهيئة خرائط جوجل ---
// يتأكد من وجود ملف Config.plist ويقرأ المفتاح منه
if let config = loadConfig(), let apiKey = config["APIKey"] as? String {
GMSServices.provideAPIKey(apiKey)
}
// --- 2. تهيئة Firebase ---
FirebaseApp.configure()
@@ -87,13 +82,7 @@ import GoogleMaps
}
}
func loadConfig() -> [String: Any]? {
guard let path = Bundle.main.path(forResource: "Config", ofType: "plist"),
let config = NSDictionary(contentsOfFile: path) as? [String: Any] else {
fatalError("Couldn't find Config.plist file. Please add it to your project.")
}
return config
}
}
// --- الامتدادات (Extensions) من الكود القديم ---

View File

@@ -1,6 +1,6 @@
// في ملف: constant/country_polygons.dart
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
class CountryPolygons {
// ==========================================================

View File

@@ -11,7 +11,7 @@ class AppLink {
/// هذا الرابط خاص برحلات الركاب، ويستخدمه السيرفر الجانبي للرحلات (Ride Server Side) للتعامل مع عمليات إلغاء الرحلات وتحديث حالة الرحلات وغيرها من العمليات المتعلقة بالرحلات.
/// https://routesy.intaleq.xyz for syria
/// for jordan https://routesjo.intaleq.xyz
static String routesOsm = 'https://routesy.intaleq.xyz';
static String routesOsm = 'https://routesjo.intaleq.xyz';
///https://location.intaleq.xyz/intaleq/ride/location
///locationServerSide هو السيرفر الجانبي الخاص بموقع السائقين، حيث يتم إرسال تحديثات الموقع من التطبيق إلى هذا السيرفر، ومن ثم يقوم هذا السيرفر بتوزيع هذه التحديثات إلى الركاب المتصلين الذين يتابعون السائق في الوقت الحقيقي.
@@ -42,7 +42,7 @@ class AppLink {
static String test = "$server/test.php";
//===============firebase==========================
static String getTokens = "$server/ride/firebase/getTokensPassenger.php.php";
static String getTokens = "$server/ride/firebase/getTokensPassenger.php";
static String getTokenParent = "$server/ride/firebase/getTokenParent.php";
static String addTokens = "$server/ride/firebase/add.php";
static String addFingerPrint = "$paymentServer/ride/firebase/add.php";

View File

@@ -1,4 +1,4 @@
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
class UniversitiesPolygons {
// AUC polygon points

View File

@@ -1,7 +1,6 @@
// import 'dart:async';
// import 'package:get/get.dart';
// import 'package:google_maps_flutter/google_maps_flutter.dart';
// import 'package:location/location.dart';
// import 'package:Intaleq/constant/box_name.dart';
// import 'package:Intaleq/constant/links.dart';

View File

@@ -1,4 +1,4 @@
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
List<LatLng> decodePolylineIsolate(String encoded) {
List<LatLng> points = [];

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
import 'package:Intaleq/constant/style.dart';
import 'package:Intaleq/controller/home/map_passenger_controller.dart';

View File

@@ -4,23 +4,25 @@ import 'dart:convert';
import 'package:Intaleq/constant/links.dart';
import 'package:Intaleq/controller/functions/crud.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
class TripMonitorController extends GetxController {
bool isLoading = false;
Map tripData = {};
late String rideId;
late String driverId;
GoogleMapController? mapController;
MapLibreMapController? mapController;
List myListString = [];
late Timer timer;
late LatLng parentLocation;
BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
BitmapDescriptor motoIcon = BitmapDescriptor.defaultMarker;
BitmapDescriptor ladyIcon = BitmapDescriptor.defaultMarker;
String carIcon = 'car';
String motoIcon = 'moto';
String ladyIcon = 'lady';
double rotation = 0;
double speed = 0;
bool isStyleLoaded = false;
getLocationParent() async {
var res = await CRUD().get(
@@ -36,21 +38,65 @@ class TripMonitorController extends GetxController {
}
}
void onMapCreated(GoogleMapController controller) async {
void onMapCreated(MapLibreMapController controller) async {
mapController = controller;
controller.getVisibleRegion();
controller.animateCamera(
update();
}
void onStyleLoaded() async {
isStyleLoaded = true;
await _loadMapIcons();
mapController?.animateCamera(
CameraUpdate.newLatLng(parentLocation),
);
update();
// Set up a timer or interval to trigger the marker update every 3 seconds.
refreshMapElements();
// Set up a timer or interval to trigger the marker update every 10 seconds.
timer = Timer.periodic(const Duration(seconds: 10), (_) async {
await getLocationParent();
mapController?.animateCamera(CameraUpdate.newLatLng(parentLocation));
refreshMapElements();
update();
});
}
Future<void> _loadMapIcons() async {
if (mapController == null) return;
final icons = {
'car': 'assets/images/car.png',
'moto': 'assets/images/moto1.png',
'lady': 'assets/images/lady1.png',
};
for (var entry in icons.entries) {
final bytes = await rootBundle.load(entry.value);
await mapController!.addImage(entry.key, bytes.buffer.asUint8List());
}
}
void refreshMapElements() async {
if (!isStyleLoaded || mapController == null) return;
await mapController!.clearSymbols();
String iconToUse = carIcon;
if (tripData['message'] != null && tripData['message'].isNotEmpty) {
final model = tripData['message'][0]['model'].toString();
final gender = tripData['message'][0]['gender'].toString();
if (model.contains('دراجة')) {
iconToUse = motoIcon;
} else if (gender == 'Female') {
iconToUse = ladyIcon;
}
}
await mapController!.addSymbol(SymbolOptions(
geometry: parentLocation,
iconImage: iconToUse,
iconRotate: rotation,
textField: 'driver',
textOpacity: 0,
));
}
// init() async {
// final arguments = Get.arguments;
// driverId = arguments['driverId'];
@@ -65,41 +111,8 @@ class TripMonitorController extends GetxController {
update();
}
void addCustomCarIcon() {
ImageConfiguration config = ImageConfiguration(
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
BitmapDescriptor.fromAssetImage(config, 'assets/images/car.png',
mipmaps: false)
.then((value) {
carIcon = value;
update();
});
void addCustomMotoIcon() {
ImageConfiguration config = ImageConfiguration(
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
BitmapDescriptor.fromAssetImage(config, 'assets/images/moto1.png',
mipmaps: false)
.then((value) {
motoIcon = value;
update();
});
}
void addCustomLadyIcon() {
ImageConfiguration config = ImageConfiguration(
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
BitmapDescriptor.fromAssetImage(config, 'assets/images/lady1.png',
mipmaps: false)
.then((value) {
ladyIcon = value;
update();
});
}
}
@override
void onInit() {
addCustomCarIcon();
super.onInit();
}

View File

@@ -4,7 +4,7 @@ class Log {
Log._();
static void print(String value, {StackTrace? stackTrace}) {
// developer.log(value, name: 'LOG', stackTrace: stackTrace);
developer.log(value, name: 'LOG', stackTrace: stackTrace);
}
static Object? inspect(Object? object) {

View File

@@ -1,11 +1,10 @@
import 'dart:io';
import 'package:Intaleq/controller/home/trip_monitor_controller.dart';
import 'package:Intaleq/views/widgets/my_scafold.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
import 'package:vibration/vibration.dart';
import '../../../../constant/colors.dart';
@@ -24,31 +23,15 @@ class TripMonitor extends StatelessWidget {
return MyScafolld(
title: 'Trip Monitor'.tr,
body: [
GoogleMap(
MapLibreMap(
onMapCreated: tripMonitorController.onMapCreated,
onStyleLoadedCallback: tripMonitorController.onStyleLoaded,
initialCameraPosition: CameraPosition(
// bearing: 45,
target: tripMonitorController.parentLocation,
zoom: 16,
tilt: 40,
),
// onCameraMove: (position) {},
markers: {
Marker(
markerId: MarkerId('start'.tr),
position: tripMonitorController.parentLocation,
draggable: true,
icon: tripMonitorController.tripData['message'][0]['model']
.contains('دراجة')
? tripMonitorController.motoIcon
: tripMonitorController.tripData['message'][0]['model']
['gender'] ==
'Male'
? tripMonitorController.carIcon
: tripMonitorController.ladyIcon,
rotation: tripMonitorController.rotation,
),
},
styleString: "assets/style.json",
),
speedCircle()
],

View File

@@ -5,7 +5,7 @@ import 'package:Intaleq/views/widgets/my_scafold.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
import 'package:vibration/vibration.dart';
import '../../../../constant/colors.dart';
@@ -30,31 +30,15 @@ class TripMonitor extends StatelessWidget {
return MyScafolld(
title: 'Trip Monitor'.tr,
body: [
GoogleMap(
MapLibreMap(
onMapCreated: tripMonitorController.onMapCreated,
onStyleLoadedCallback: tripMonitorController.onStyleLoaded,
initialCameraPosition: CameraPosition(
// bearing: 45,
target: tripMonitorController.parentLocation,
zoom: 16,
tilt: 40,
),
// onCameraMove: (position) {},
markers: {
Marker(
markerId: MarkerId('start'.tr),
position: tripMonitorController.parentLocation,
draggable: true,
icon: tripMonitorController.tripData['message'][0]['model']
.contains('دراجة')
? tripMonitorController.motoIcon
: tripMonitorController.tripData['message'][0]['model']
['gender'] ==
'Male'
? tripMonitorController.carIcon
: tripMonitorController.ladyIcon,
rotation: tripMonitorController.rotation,
),
},
styleString: "assets/style.json",
),
speedCircle()
],

View File

@@ -2,7 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
import 'package:Intaleq/constant/box_name.dart';
import 'package:Intaleq/constant/table_names.dart';
import 'package:Intaleq/views/widgets/elevated_btn.dart';

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
import '../../../constant/colors.dart';
import '../../../constant/style.dart';

View File

@@ -1,14 +1,11 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
import 'package:Intaleq/controller/home/points_for_rider_controller.dart';
import '../../../constant/colors.dart';
import '../../../constant/style.dart';
// import '../../../controller/functions/location_controller.dart'; // Un-comment if needed
// import '../../../controller/home/device_tier.dart'; // Removed to rely on Controller logic
import '../../../controller/home/map_passenger_controller.dart';
import '../../widgets/mycircular.dart';
import '../../widgets/mydialoug.dart';
@@ -28,29 +25,46 @@ class GoogleMapPassengerWidget extends StatelessWidget {
top: 0,
left: 0,
right: 0,
child: GoogleMap(
child: MapLibreMap(
onMapCreated: controller.onMapCreated,
// ✅ Camera Bounds
cameraTargetBounds: CameraTargetBounds(controller.boundsdata),
onStyleLoadedCallback: () => controller.onStyleLoaded(),
styleString: "assets/style.json",
// ✅ Performance: Smoother zoom limits for low-end devices
minMaxZoomPreference: controller.lowPerf
? const MinMaxZoomPreference(6, 17)
: const MinMaxZoomPreference(6, 18),
// ✅ Destination Selection on Long Press
onLongPress: (LatLng argument) {
initialCameraPosition: CameraPosition(
target: controller.passengerLocation,
zoom: controller.lowPerf ? 14.5 : 15,
),
// ✅ Map Settings
myLocationEnabled: true,
trackCameraPosition: true,
// ✅ Camera Movement Logic
onCameraIdle: () {
if (controller.mapController != null) {
final position = controller.mapController!.cameraPosition;
if (position != null) {
print('✅ onCameraIdle targeted: ${position.target}');
// 1. Always update current view target (for pickers)
controller
.updateCurrentLocationFromCamera(position.target);
}
}
},
onMapLongClick: (point, latlng) {
MyDialog().getDialog('Are you want to go to this site'.tr, '',
() async {
controller.clearPolyline();
// Ensure we have car data available before routing
// if (controller.dataCarsLocationByPassenger != null) {
// i use this check if needed
if (controller.carsLocationByPassenger.isNotEmpty) {
await controller.getDirectionMap(
'${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
'${argument.latitude},${argument.longitude}',
'${latlng.latitude},${latlng.longitude}',
);
Get.back(); // Close Dialog
await controller.bottomSheet();
@@ -76,80 +90,9 @@ class GoogleMapPassengerWidget extends StatelessWidget {
});
},
// ✅ Hide UI elements on tap
onTap: (argument) {
onMapClick: (point, latlng) {
controller.hidePlaces();
},
initialCameraPosition: CameraPosition(
target: controller.passengerLocation,
zoom: controller.lowPerf ? 14.5 : 15,
),
// ✅ Markers
markers: controller.markers.toSet(),
// ✅ Polygons (e.g., University/Country borders)
polygons: controller.polygons,
// ✅ Polylines: Switch to lighter version if lowPerf is detected
polylines: controller.lowPerf
? controller.polyLinesLight.toSet()
: controller.polyLines.toSet(),
// ✅ Map Type: Switch to Normal map on low-end devices to save RAM
mapType: controller.lowPerf
? MapType.normal
: (controller.mapType
? MapType.satellite
: MapType
.normal), // Changed terrain default to normal for better performance
// ✅ UI Settings for Performance
myLocationButtonEnabled: false,
mapToolbarEnabled: false,
tiltGesturesEnabled:
false, // Disable tilt to save GPU resources
// Lite Mode (Static image) only on very low-end Androids if needed,
// but usually handled by lowPerf logic in mapType/Traffic
liteModeEnabled: Platform.isAndroid && controller.lowPerf,
trafficEnabled: controller.mapTrafficON && !controller.lowPerf,
buildingsEnabled: !controller.lowPerf,
rotateGesturesEnabled:
!controller.lowPerf, // Disable rotation on low-end
// ✅ Camera Movement Logic
onCameraMove: (CameraPosition position) {
// 1. Always update current view target (for pickers)
controller.newMyLocation = position.target;
// 2. Handle Drag-to-Select for specific states
if (controller.startLocationFromMap == true) {
controller.newStartPointLocation = position.target;
} else if (controller.passengerStartLocationFromMap == true) {
controller.newStartPointLocation = position.target;
}
// 3. Handle Waypoints Dragging
int waypointsLength =
Get.find<WayPointController>().wayPoints.length;
if (waypointsLength > 0 &&
controller.wayPointIndex >= 0 &&
controller.wayPointIndex <
controller.placesCoordinate.length) {
controller.placesCoordinate[controller.wayPointIndex] =
'${position.target.latitude},${position.target.longitude}';
}
// 4. Throttle heavy calculations (Reverse Geocoding / API calls)
if (controller.lowPerf) {
controller.onCameraMoveThrottled(position);
}
},
myLocationEnabled: false,
),
),
);

View File

@@ -3,7 +3,7 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
import 'dart:ui'; // مهم لإضافة تأثير الضبابية
import '../../../constant/colors.dart';

View File

@@ -8,7 +8,7 @@ import 'package:Intaleq/controller/home/map_passenger_controller.dart';
import 'package:Intaleq/main.dart';
import 'package:Intaleq/views/home/map_widget.dart/form_search_places_destenation.dart';
import 'package:Intaleq/views/widgets/elevated_btn.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
import '../../../constant/colors.dart';
import '../../../constant/table_names.dart';
import '../../../controller/functions/toast.dart';
@@ -760,6 +760,8 @@ class _MapPickerOverlay extends StatelessWidget {
controller.newMyLocation.latitude,
controller.newMyLocation.longitude,
);
print('🌐 MAP PICKER CENTER: ${currentCameraPosition.latitude}, ${currentCameraPosition.longitude}');
print('✅ _onConfirmTap confirmed coordinates: ${currentCameraPosition.latitude}, ${currentCameraPosition.longitude}');
// ── CASE 0: Waypoint picker mode ──────────────────────────────────────
if (controller.isPickingWaypoint && controller.pickingWaypointIndex >= 0) {

View File

@@ -3,7 +3,7 @@ import 'package:get/get.dart';
import 'package:Intaleq/constant/style.dart';
import 'package:Intaleq/views/widgets/my_scafold.dart';
import 'package:Intaleq/views/widgets/mycircular.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
import '../../../constant/colors.dart';
import '../../../controller/functions/launch.dart';
@@ -72,6 +72,7 @@ class OrderHistory extends StatelessWidget {
double.parse(ride['end_location'].toString().split(',')[0]),
double.parse(ride['end_location'].toString().split(',')[1]),
);
final LatLngBounds bounds = LatLngBounds(
northeast: LatLng(
startLocation.latitude > endLocation.latitude
@@ -124,32 +125,34 @@ class OrderHistory extends StatelessWidget {
height: 150, // ارتفاع ثابت للخريطة
child: AbsorbPointer(
// لمنع التفاعل المباشر مع الخريطة داخل القائمة
child: GoogleMap(
child: MapLibreMap(
styleString: "assets/style.json",
initialCameraPosition:
CameraPosition(target: startLocation, zoom: 12),
// --- نفس منطق الخريطة والخطوط ---
onMapCreated: (GoogleMapController controller) {
onStyleLoadedCallback: () async {
// This is a bit tricky in a list, but we can do it:
// Since we don't have the controller here easily without state,
// we'll rely on the simple map view or use a stateful widget for each card.
// For now, let's keep it simple.
},
onMapCreated: (MapLibreMapController controller) async {
await controller.addSymbol(SymbolOptions(
geometry: startLocation,
iconImage: 'start_icon',
));
await controller.addSymbol(SymbolOptions(
geometry: endLocation,
iconImage: 'end_icon',
));
await controller.addLine(LineOptions(
geometry: [startLocation, endLocation],
lineColor: '#${AppColor.primaryColor.value.toRadixString(16).substring(2)}',
lineWidth: 4,
));
controller.animateCamera(
CameraUpdate.newLatLngBounds(bounds, 60));
CameraUpdate.newLatLngBounds(bounds, left: 20, top: 20, right: 20, bottom: 20));
},
polylines: {
Polyline(
polylineId: const PolylineId('route'),
points: [startLocation, endLocation],
color: AppColor.primaryColor,
width: 4,
),
},
markers: {
Marker(
markerId: const MarkerId('start'),
position: startLocation),
Marker(
markerId: const MarkerId('end'),
position: endLocation),
},
mapToolbarEnabled: false,
zoomControlsEnabled: false,
),
),
),

View File

@@ -932,42 +932,42 @@ packages:
dependency: "direct main"
description:
name: google_maps_flutter
sha256: "9b0d6dab3de6955837575dc371dd772fcb5d0a90f6a4954e8c066472f9938550"
sha256: fc714bf8072e2c121d4277cb6dca23bbfae954b6c7b5d6dd73f1bc8d09762921
url: "https://pub.dev"
source: hosted
version: "2.14.2"
version: "2.17.0"
google_maps_flutter_android:
dependency: transitive
description:
name: google_maps_flutter_android
sha256: "8b569c7abc52bc62d4502bf93847d487c0843f3e6a2a8e122b72e98843b2ab4c"
sha256: "9c14d3d58a398d6182c2c674b17d36c16a1d64c2c60891e9acf019856319c512"
url: "https://pub.dev"
source: hosted
version: "2.19.1"
version: "2.19.5"
google_maps_flutter_ios:
dependency: transitive
description:
name: google_maps_flutter_ios
sha256: "174d730bc3f253e1c06a342d7a5efb216f15003a6e26693c2d70d60973625af4"
sha256: "5ed8d8d0f93dfa7f5039c409c500948e98e59068f8f6fcf9105bfd07e3709d7f"
url: "https://pub.dev"
source: hosted
version: "2.17.5"
version: "2.18.1"
google_maps_flutter_platform_interface:
dependency: transitive
description:
name: google_maps_flutter_platform_interface
sha256: "0f8c6674d70c7e9a09cd34f63b18ebaf8a5822e85b558128eae0fdf02b4a3e93"
sha256: ddbe34435dfb34e83fca295c6a8dcc53c3b51487e9eec3c737ce4ae605574347
url: "https://pub.dev"
source: hosted
version: "2.14.2"
version: "2.15.0"
google_maps_flutter_web:
dependency: transitive
description:
name: google_maps_flutter_web
sha256: d416602944e1859f3cbbaa53e34785c223fa0a11eddb34a913c964c5cbb5d8cf
sha256: "6cefe4ef4cc61dc0dfba4c413dec4bd105cb6b9461bfbe1465ddd09f80af377d"
url: "https://pub.dev"
source: hosted
version: "0.5.14+3"
version: "0.6.2"
google_sign_in:
dependency: "direct main"
description:
@@ -1220,10 +1220,10 @@ packages:
dependency: transitive
description:
name: js
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.7.2"
version: "0.6.7"
json_annotation:
dependency: transitive
description:
@@ -1264,6 +1264,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.1"
latlong2:
dependency: "direct main"
description:
name: latlong2
sha256: "98227922caf49e6056f91b6c56945ea1c7b166f28ffcd5fb8e72fc0b453cc8fe"
url: "https://pub.dev"
source: hosted
version: "0.9.1"
leak_tracker:
dependency: transitive
description:
@@ -1376,6 +1384,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.0"
maplibre_gl:
dependency: "direct main"
description:
name: maplibre_gl
sha256: d9773555ae4ebab94bbc3ae2176b077cfda486ec729eefe01e1613f164cb8410
url: "https://pub.dev"
source: hosted
version: "0.25.0"
maplibre_gl_platform_interface:
dependency: transitive
description:
name: maplibre_gl_platform_interface
sha256: bd7de401dea24dd7e8a6f2fa736ddee7dbbee3e24a9027f0afdd619994702047
url: "https://pub.dev"
source: hosted
version: "0.25.0"
maplibre_gl_web:
dependency: transitive
description:
name: maplibre_gl_web
sha256: af0e48bf96e8dd99f8b958a1953126971eb8a0527b9735441d4f24df3913f5a2
url: "https://pub.dev"
source: hosted
version: "0.25.0"
matcher:
dependency: transitive
description:
@@ -1856,18 +1888,18 @@ packages:
dependency: "direct main"
description:
name: socket_io_client
sha256: ef6c989e5eee8d04baf18482ec3d7699b91bc41e279794a99d8e3bef897b074a
sha256: "64bd271703db3682d4195dd813c555413d21a49bbaef7c3ed38932fd2a209a10"
url: "https://pub.dev"
source: hosted
version: "3.1.4"
version: "1.0.2"
socket_io_common:
dependency: transitive
description:
name: socket_io_common
sha256: "162fbaecbf4bf9a9372a62a341b3550b51dcef2f02f3e5830a297fd48203d45b"
sha256: "469c7e6bb0c8d571a5158c1352112654f03aedc2f0a246533e1cbdb41efa4937"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "1.0.1"
source_gen:
dependency: transitive
description:

View File

@@ -78,9 +78,9 @@ dependencies:
internet_connection_checker: ^3.0.1
connectivity_plus: ^6.1.5
app_links: ^7.0.0
socket_io_client: ^3.1.4
# flutter_map: ^8.2.2
# latlong2: ^0.9.1
latlong2: ^0.9.1
maplibre_gl: ^0.25.0
socket_io_client: ^1.0.2
# home_widget: ^0.7.0+1
dev_dependencies: