feat: implement gate selection bottom sheet for location routing and update intaleq_maps dependency
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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<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) ────────────────────────────────────────────────
|
||||
static void addStop() => _s.addMenuWaypoint();
|
||||
static void removeStop(int index) => _s.removeMenuWaypoint(index);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user