diff --git a/siro_driver/pubspec.yaml b/siro_driver/pubspec.yaml index 5a6c3fd6..41d4826b 100644 --- a/siro_driver/pubspec.yaml +++ b/siro_driver/pubspec.yaml @@ -18,8 +18,7 @@ dependencies: path: ../../Intaleq/packages/get get_storage: path: ../../Intaleq/packages/get_storage - intaleq_maps: - path: ../../map-saas/packages/flutter-sdk/ + intaleq_maps: ^2.2.1 secure_string_operations: path: ./secure_string_operations trip_overlay_plugin: diff --git a/siro_rider/lib/views/home/route_planner/rp_actions.dart b/siro_rider/lib/views/home/route_planner/rp_actions.dart index c2754f70..28dfebbc 100644 --- a/siro_rider/lib/views/home/route_planner/rp_actions.dart +++ b/siro_rider/lib/views/home/route_planner/rp_actions.dart @@ -11,6 +11,7 @@ import '../../../controller/home/map/ride_lifecycle_controller.dart'; import '../../../main.dart'; import '../../../print.dart'; import '../../widgets/mydialoug.dart'; +import 'rp_theme.dart'; /// All controller side-effects for the route planner live here, so the /// widgets stay declarative. This is a faithful port of the behavior that @@ -106,6 +107,89 @@ class RpActions { _s.update(); } + // ── Gate Selection (Bottom Sheet) ────────────────────────────────────────── + static void handleLocationSelection( + BuildContext context, int index, dynamic place, bool isOrigin) { + final hasGates = place['gates'] != null && + place['gates'] is List && + (place['gates'] as List).isNotEmpty; + + if (!hasGates) { + if (isOrigin) { + selectStart(place); + } else { + selectDestination(index, place); + } + return; + } + + final List gates = place['gates']; + final bool isArabic = Get.locale?.languageCode == 'ar'; + + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + isScrollControlled: true, + builder: (context) { + return Container( + padding: const EdgeInsets.only(top: 12, left: 16, right: 16, bottom: 24), + decoration: BoxDecoration( + color: RP.sheetElevated, + borderRadius: const BorderRadius.vertical(top: Radius.circular(RP.rSheet)), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + RP.grabber(), + const SizedBox(height: 16), + Text( + 'Select Gate'.tr, + style: RP.title, + ), + const SizedBox(height: 16), + ...gates.map((gate) { + final String gateName = isArabic + ? (gate['name_ar'] ?? gate['name_en'] ?? 'Gate'.tr) + : (gate['name_en'] ?? gate['name_ar'] ?? 'Gate'.tr); + + return ListTile( + contentPadding: EdgeInsets.zero, + leading: Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: AppColor.primaryColor.withOpacity(0.1), + shape: BoxShape.circle, + ), + child: const Icon(Icons.door_sliding_outlined, + color: AppColor.primaryColor, size: 20), + ), + title: Text(gateName, style: RP.fieldValue), + subtitle: gate['is_main_gate'] == true + ? Text('Main Gate'.tr, style: RP.body) + : null, + onTap: () { + Navigator.pop(context); + final modifiedPlace = Map.from(place); + modifiedPlace['latitude'] = gate['latitude']; + modifiedPlace['longitude'] = gate['longitude']; + modifiedPlace['name_ar'] = '${place['name_ar'] ?? place['name'] ?? ''} - $gateName'; + modifiedPlace['name'] = '${place['name'] ?? place['name_ar'] ?? ''} - $gateName'; + + if (isOrigin) { + selectStart(modifiedPlace); + } else { + selectDestination(index, modifiedPlace); + } + }, + ); + }), + ], + ), + ); + }, + ); + } + // ── Stops (menu waypoints) ──────────────────────────────────────────────── static void addStop() => _s.addMenuWaypoint(); static void removeStop(int index) => _s.removeMenuWaypoint(index); diff --git a/siro_rider/lib/views/home/route_planner/rp_search_dialog.dart b/siro_rider/lib/views/home/route_planner/rp_search_dialog.dart index 390bf3b0..26fe58ca 100644 --- a/siro_rider/lib/views/home/route_planner/rp_search_dialog.dart +++ b/siro_rider/lib/views/home/route_planner/rp_search_dialog.dart @@ -57,12 +57,7 @@ class RpSearchDialog extends StatelessWidget { void _onSelect(int index, dynamic place, BuildContext context) { Navigator.of(context).pop(); - - if (isOrigin) { - RpActions.selectStart(place); - } else { - RpActions.selectDestination(index, place); - } + RpActions.handleLocationSelection(Get.context!, index, place, isOrigin); } @override diff --git a/siro_rider/lib/views/home/route_planner/rp_sheet.dart b/siro_rider/lib/views/home/route_planner/rp_sheet.dart index a0ca4032..860f9413 100644 --- a/siro_rider/lib/views/home/route_planner/rp_sheet.dart +++ b/siro_rider/lib/views/home/route_planner/rp_sheet.dart @@ -267,7 +267,7 @@ class _Expanded extends StatelessWidget { onQuery: (_) => s.getPlacesStart(), onEmpty: s.clearPlacesStart, onPickOnMap: RpActions.pickOtherPickupOnMap, - onResultTap: (i) => RpActions.selectStart(s.placesStart[i]), + onResultTap: (i) => RpActions.handleLocationSelection(Get.context!, i, s.placesStart[i], true), searchable: false, onTapField: () { RpSearchDialog.show( @@ -320,7 +320,7 @@ class _Expanded extends StatelessWidget { mapEngine.changeHeightPlaces(); }, onPickOnMap: RpActions.pickDestinationOnMap, - onResultTap: (i) => RpActions.selectDestination(i, s.placesDestination[i]), + onResultTap: (i) => RpActions.handleLocationSelection(Get.context!, i, s.placesDestination[i], false), searchable: false, onTapField: () { RpSearchDialog.show( diff --git a/siro_rider/pubspec.lock b/siro_rider/pubspec.lock index c799a5dd..6dbe2f7d 100644 --- a/siro_rider/pubspec.lock +++ b/siro_rider/pubspec.lock @@ -1056,10 +1056,11 @@ packages: intaleq_maps: dependency: "direct main" description: - path: "../../map-saas/packages/flutter-sdk" - relative: true - source: path - version: "2.2.0" + name: intaleq_maps + sha256: "4307196a9a9a4d4dfd29fd984ecd1f7460051523c74f9b201f0ba641dbda78a2" + url: "https://pub.dev" + source: hosted + version: "2.2.1" internet_connection_checker: dependency: "direct main" description: diff --git a/siro_rider/pubspec.yaml b/siro_rider/pubspec.yaml index 0be3937f..b026979e 100644 --- a/siro_rider/pubspec.yaml +++ b/siro_rider/pubspec.yaml @@ -79,11 +79,7 @@ dependencies: internet_connection_checker: ^3.0.1 connectivity_plus: ^6.1.5 app_links: ^7.0.0 - # 🔧 مؤقتاً: نستخدم نفس نسخة الحزمة المحلية المُصلَحة التي يستخدمها تطبيق - # السائق (بدل النسخة 2.2.0 المنشورة على pub.dev) لاختبار إصلاح مقارنة - # Polyline/Marker على التطبيقين معاً قبل رفع نسخة رسمية جديدة على pub.dev. - intaleq_maps: - path: ../../map-saas/packages/flutter-sdk/ + intaleq_maps: ^2.2.1 socket_io_client: 1.0.2 # home_widget: ^0.7.0+1