feat: implement gate selection bottom sheet for location routing and update intaleq_maps dependency

This commit is contained in:
Hamza-Ayed
2026-07-21 16:12:08 +03:00
parent 085b180bdb
commit 13d10d13c7
6 changed files with 94 additions and 19 deletions
+1 -2
View File
@@ -18,8 +18,7 @@ dependencies:
path: ../../Intaleq/packages/get path: ../../Intaleq/packages/get
get_storage: get_storage:
path: ../../Intaleq/packages/get_storage path: ../../Intaleq/packages/get_storage
intaleq_maps: intaleq_maps: ^2.2.1
path: ../../map-saas/packages/flutter-sdk/
secure_string_operations: secure_string_operations:
path: ./secure_string_operations path: ./secure_string_operations
trip_overlay_plugin: trip_overlay_plugin:
@@ -11,6 +11,7 @@ import '../../../controller/home/map/ride_lifecycle_controller.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../../../print.dart'; import '../../../print.dart';
import '../../widgets/mydialoug.dart'; import '../../widgets/mydialoug.dart';
import 'rp_theme.dart';
/// All controller side-effects for the route planner live here, so the /// All controller side-effects for the route planner live here, so the
/// widgets stay declarative. This is a faithful port of the behavior that /// widgets stay declarative. This is a faithful port of the behavior that
@@ -106,6 +107,89 @@ class RpActions {
_s.update(); _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<String, dynamic>.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) ──────────────────────────────────────────────── // ── Stops (menu waypoints) ────────────────────────────────────────────────
static void addStop() => _s.addMenuWaypoint(); static void addStop() => _s.addMenuWaypoint();
static void removeStop(int index) => _s.removeMenuWaypoint(index); static void removeStop(int index) => _s.removeMenuWaypoint(index);
@@ -57,12 +57,7 @@ class RpSearchDialog extends StatelessWidget {
void _onSelect(int index, dynamic place, BuildContext context) { void _onSelect(int index, dynamic place, BuildContext context) {
Navigator.of(context).pop(); Navigator.of(context).pop();
RpActions.handleLocationSelection(Get.context!, index, place, isOrigin);
if (isOrigin) {
RpActions.selectStart(place);
} else {
RpActions.selectDestination(index, place);
}
} }
@override @override
@@ -267,7 +267,7 @@ class _Expanded extends StatelessWidget {
onQuery: (_) => s.getPlacesStart(), onQuery: (_) => s.getPlacesStart(),
onEmpty: s.clearPlacesStart, onEmpty: s.clearPlacesStart,
onPickOnMap: RpActions.pickOtherPickupOnMap, onPickOnMap: RpActions.pickOtherPickupOnMap,
onResultTap: (i) => RpActions.selectStart(s.placesStart[i]), onResultTap: (i) => RpActions.handleLocationSelection(Get.context!, i, s.placesStart[i], true),
searchable: false, searchable: false,
onTapField: () { onTapField: () {
RpSearchDialog.show( RpSearchDialog.show(
@@ -320,7 +320,7 @@ class _Expanded extends StatelessWidget {
mapEngine.changeHeightPlaces(); mapEngine.changeHeightPlaces();
}, },
onPickOnMap: RpActions.pickDestinationOnMap, onPickOnMap: RpActions.pickDestinationOnMap,
onResultTap: (i) => RpActions.selectDestination(i, s.placesDestination[i]), onResultTap: (i) => RpActions.handleLocationSelection(Get.context!, i, s.placesDestination[i], false),
searchable: false, searchable: false,
onTapField: () { onTapField: () {
RpSearchDialog.show( RpSearchDialog.show(
+5 -4
View File
@@ -1056,10 +1056,11 @@ packages:
intaleq_maps: intaleq_maps:
dependency: "direct main" dependency: "direct main"
description: description:
path: "../../map-saas/packages/flutter-sdk" name: intaleq_maps
relative: true sha256: "4307196a9a9a4d4dfd29fd984ecd1f7460051523c74f9b201f0ba641dbda78a2"
source: path url: "https://pub.dev"
version: "2.2.0" source: hosted
version: "2.2.1"
internet_connection_checker: internet_connection_checker:
dependency: "direct main" dependency: "direct main"
description: description:
+1 -5
View File
@@ -79,11 +79,7 @@ dependencies:
internet_connection_checker: ^3.0.1 internet_connection_checker: ^3.0.1
connectivity_plus: ^6.1.5 connectivity_plus: ^6.1.5
app_links: ^7.0.0 app_links: ^7.0.0
# 🔧 مؤقتاً: نستخدم نفس نسخة الحزمة المحلية المُصلَحة التي يستخدمها تطبيق intaleq_maps: ^2.2.1
# السائق (بدل النسخة 2.2.0 المنشورة على pub.dev) لاختبار إصلاح مقارنة
# Polyline/Marker على التطبيقين معاً قبل رفع نسخة رسمية جديدة على pub.dev.
intaleq_maps:
path: ../../map-saas/packages/flutter-sdk/
socket_io_client: 1.0.2 socket_io_client: 1.0.2
# home_widget: ^0.7.0+1 # home_widget: ^0.7.0+1