Update: 2026-07-06 04:16:38
This commit is contained in:
@@ -45,8 +45,8 @@ class MapPagePassenger extends StatelessWidget {
|
||||
Get.find<CRUD>();
|
||||
|
||||
// ✅ تهيئة البيانات بعد تسجيل الدخول إن لم تكن قد تهيأت بالفعل
|
||||
final bool isLoggedIn = box.read(BoxName.isVerified) == '1' &&
|
||||
box.read(BoxName.passengerID) != null;
|
||||
final bool isLoggedIn = box.read(BoxName.isVerified) == '1' &&
|
||||
box.read(BoxName.passengerID) != null;
|
||||
if (isLoggedIn && !rideLifecycle.isDataInitializedAfterLogin) {
|
||||
rideLifecycle.initializeDataAfterLogin();
|
||||
}
|
||||
@@ -56,6 +56,7 @@ class MapPagePassenger extends StatelessWidget {
|
||||
});
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Get.isDarkMode ? const Color(0xFF1E1E1E) : Colors.white,
|
||||
body: SafeArea(
|
||||
bottom: true,
|
||||
child: Stack(
|
||||
@@ -108,22 +109,35 @@ class AttributionMap extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Positioned(
|
||||
left: 4,
|
||||
bottom: 20,
|
||||
child: RotatedBox(
|
||||
quarterTurns: 0, // يخلي النص عمودي (من تحت لفوق)
|
||||
child: Opacity(
|
||||
opacity: 0.7,
|
||||
child: Text(
|
||||
"Siro Maps",
|
||||
// "Siro Maps • © OpenStreetMap contributors",
|
||||
left: 12,
|
||||
bottom: Get.height * 0.2 + 4,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/logo.png',
|
||||
width: 10,
|
||||
height: 10,
|
||||
color: Colors.grey.shade500,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"Intaleq Maps",
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: Colors.grey[700],
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 9,
|
||||
color: Colors.grey.shade500,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: 0.3,
|
||||
shadows: [
|
||||
Shadow(
|
||||
blurRadius: 3,
|
||||
color: Colors.black.withValues(alpha: 0.3),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'dart:ui' show ImageFilter;
|
||||
import 'package:siro_rider/print.dart';
|
||||
import 'package:siro_rider/views/widgets/my_textField.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -74,18 +75,6 @@ class _D {
|
||||
stops: const [0.0, 0.5, 1.0],
|
||||
);
|
||||
|
||||
static LinearGradient cardGradient() => LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
AppColor.secondaryColor.withValues(alpha: 0.98),
|
||||
AppColor.secondaryColor
|
||||
.withBlue(
|
||||
((AppColor.secondaryColor.b * 255.0).round() + 12).clamp(0, 255),
|
||||
)
|
||||
.withValues(alpha: 0.95),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
@@ -107,32 +96,38 @@ class MainBottomMenuMap extends StatelessWidget {
|
||||
bottom: Get.height * .035,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: AnimatedContainer(
|
||||
duration: _D.medium,
|
||||
curve: Curves.easeOutQuint,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: controller.isMainBottomMenuMap
|
||||
? Get.height * 0.4
|
||||
: Get.height * 0.75, // الحد الأقصى للشاشة المفتوحة
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: _D.cardGradient(),
|
||||
borderRadius: BorderRadius.circular(_D.radiusCard),
|
||||
boxShadow: _D.cardShadow,
|
||||
border: Border.all(
|
||||
color: Get.isDarkMode
|
||||
? Colors.white.withValues(alpha: 0.15)
|
||||
: Colors.white.withValues(alpha: 0.65),
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(_D.radiusCard),
|
||||
child: SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
child: controller.isMainBottomMenuMap
|
||||
? const _CollapsedView()
|
||||
: const _ExpandedView(),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(_D.radiusCard),
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 14, sigmaY: 14),
|
||||
child: AnimatedContainer(
|
||||
duration: _D.medium,
|
||||
curve: Curves.easeOutQuint,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: controller.isMainBottomMenuMap
|
||||
? Get.height * 0.4
|
||||
: Get.height * 0.75,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.cardColor.withValues(alpha: 0.88),
|
||||
borderRadius: BorderRadius.circular(_D.radiusCard),
|
||||
boxShadow: _D.cardShadow,
|
||||
border: Border.all(
|
||||
color: Get.isDarkMode
|
||||
? Colors.white.withValues(alpha: 0.15)
|
||||
: Colors.white.withValues(alpha: 0.65),
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(_D.radiusCard),
|
||||
child: SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
child: controller.isMainBottomMenuMap
|
||||
? const _CollapsedView()
|
||||
: const _ExpandedView(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -259,8 +254,8 @@ class _CollapsedView extends StatelessWidget {
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: locationSearch.recentPlaces.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(width: 10),
|
||||
itemBuilder: (context, index) =>
|
||||
_RecentPlaceChip(locationSearch: locationSearch, index: index),
|
||||
itemBuilder: (context, index) => _RecentPlaceChip(
|
||||
locationSearch: locationSearch, index: index),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
@@ -373,8 +368,9 @@ class _ExpandedView extends StatelessWidget {
|
||||
...List.generate(locationSearch.activeMenuWaypointCount, (index) {
|
||||
final wpName = locationSearch.menuWaypointNames[index];
|
||||
final isSet = locationSearch.menuWaypoints[index] != null;
|
||||
final Color accent =
|
||||
index == 0 ? Colors.amber.shade600 : Colors.deepPurple.shade400;
|
||||
final Color accent = index == 0
|
||||
? Colors.amber.shade600
|
||||
: Colors.deepPurple.shade400;
|
||||
final Color soft =
|
||||
index == 0 ? Colors.amber.shade50 : Colors.deepPurple.shade50;
|
||||
|
||||
@@ -383,10 +379,13 @@ class _ExpandedView extends StatelessWidget {
|
||||
showTopLine: true,
|
||||
showBottomLine: true,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [soft.withValues(alpha: 0.9), soft.withValues(alpha: 0.6)]),
|
||||
gradient: LinearGradient(colors: [
|
||||
soft.withValues(alpha: 0.9),
|
||||
soft.withValues(alpha: 0.6)
|
||||
]),
|
||||
borderRadius: BorderRadius.circular(_D.radiusInner),
|
||||
border: Border.all(
|
||||
color: isSet
|
||||
@@ -398,8 +397,8 @@ class _ExpandedView extends StatelessWidget {
|
||||
Container(
|
||||
width: 26,
|
||||
height: 26,
|
||||
decoration:
|
||||
BoxDecoration(color: accent, shape: BoxShape.circle),
|
||||
decoration: BoxDecoration(
|
||||
color: accent, shape: BoxShape.circle),
|
||||
child: Center(
|
||||
child: Text('${index + 1}',
|
||||
style: const TextStyle(
|
||||
@@ -421,7 +420,8 @@ class _ExpandedView extends StatelessWidget {
|
||||
color: isSet
|
||||
? accent.withValues(alpha: 0.9)
|
||||
: Colors.grey.shade400,
|
||||
fontWeight: isSet ? FontWeight.w600 : FontWeight.w400,
|
||||
fontWeight:
|
||||
isSet ? FontWeight.w600 : FontWeight.w400,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -433,7 +433,8 @@ class _ExpandedView extends StatelessWidget {
|
||||
width: 28,
|
||||
height: 28,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red.shade50, shape: BoxShape.circle),
|
||||
color: Colors.red.shade50,
|
||||
shape: BoxShape.circle),
|
||||
child: Icon(Icons.close_rounded,
|
||||
color: Colors.red.shade400, size: 15),
|
||||
),
|
||||
@@ -454,11 +455,12 @@ class _ExpandedView extends StatelessWidget {
|
||||
onTap: () => locationSearch.addMenuWaypoint(),
|
||||
borderRadius: BorderRadius.circular(_D.radiusInner),
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(_D.radiusInner),
|
||||
border: Border.all(color: Colors.orange.shade200, width: 1.5),
|
||||
border:
|
||||
Border.all(color: Colors.orange.shade200, width: 1.5),
|
||||
color: Colors.orange.shade50.withValues(alpha: 0.6),
|
||||
),
|
||||
child: Row(
|
||||
@@ -510,8 +512,8 @@ class _ExpandedView extends StatelessWidget {
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: locationSearch.recentPlaces.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(width: 10),
|
||||
itemBuilder: (context, index) =>
|
||||
_RecentPlaceChip(locationSearch: locationSearch, index: index),
|
||||
itemBuilder: (context, index) => _RecentPlaceChip(
|
||||
locationSearch: locationSearch, index: index),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -611,7 +613,8 @@ class _ExpandedView extends StatelessWidget {
|
||||
class _MapPickerOverlay extends StatelessWidget {
|
||||
const _MapPickerOverlay();
|
||||
|
||||
String _getModeTitle(LocationSearchController locationSearch, BuildContext context) {
|
||||
String _getModeTitle(
|
||||
LocationSearchController locationSearch, BuildContext context) {
|
||||
if (locationSearch.isPickingWaypoint) {
|
||||
return 'Move map to set stop'.tr +
|
||||
' ${locationSearch.pickingWaypointIndex + 1}'.tr;
|
||||
@@ -634,7 +637,8 @@ class _MapPickerOverlay extends StatelessWidget {
|
||||
return 'Move map to select destination'.tr;
|
||||
}
|
||||
|
||||
String _getConfirmLabel(LocationSearchController locationSearch, BuildContext context) {
|
||||
String _getConfirmLabel(
|
||||
LocationSearchController locationSearch, BuildContext context) {
|
||||
if (locationSearch.isPickingWaypoint) return 'Set as Stop'.tr;
|
||||
if (locationSearch.passengerStartLocationFromMap) {
|
||||
return 'Confirm Pickup Location'.tr;
|
||||
@@ -656,7 +660,8 @@ class _MapPickerOverlay extends StatelessWidget {
|
||||
|
||||
Color _getModeColor(LocationSearchController locationSearch) {
|
||||
if (locationSearch.isPickingWaypoint) return Colors.orange.shade600;
|
||||
if (locationSearch.passengerStartLocationFromMap) return Colors.green.shade600;
|
||||
if (locationSearch.passengerStartLocationFromMap)
|
||||
return Colors.green.shade600;
|
||||
if (locationSearch.workLocationFromMap) return Colors.blue.shade600;
|
||||
if (locationSearch.homeLocationFromMap) return Colors.orange.shade600;
|
||||
return AppColor.primaryColor;
|
||||
@@ -678,14 +683,16 @@ class _MapPickerOverlay extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: modeColor,
|
||||
borderRadius: BorderRadius.circular(_D.radiusCard),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(_getModeIcon(locationSearch), color: Colors.white, size: 19),
|
||||
Icon(_getModeIcon(locationSearch),
|
||||
color: Colors.white, size: 19),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Text(
|
||||
@@ -713,7 +720,8 @@ class _MapPickerOverlay extends StatelessWidget {
|
||||
padding: const EdgeInsets.fromLTRB(20, 18, 20, 2),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.gps_fixed_rounded, color: modeColor, size: 16),
|
||||
Icon(Icons.gps_fixed_rounded,
|
||||
color: modeColor, size: 16),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Text(
|
||||
@@ -737,7 +745,8 @@ class _MapPickerOverlay extends StatelessWidget {
|
||||
child: OutlinedButton(
|
||||
onPressed: () {
|
||||
mapEngine.isPickerShown = false;
|
||||
locationSearch.passengerStartLocationFromMap = false;
|
||||
locationSearch.passengerStartLocationFromMap =
|
||||
false;
|
||||
locationSearch.startLocationFromMap = false;
|
||||
locationSearch.workLocationFromMap = false;
|
||||
locationSearch.homeLocationFromMap = false;
|
||||
@@ -758,10 +767,12 @@ class _MapPickerOverlay extends StatelessWidget {
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: ElevatedButton(
|
||||
onPressed: () => _onConfirmTap(mapEngine, locationSearch, context),
|
||||
onPressed: () => _onConfirmTap(
|
||||
mapEngine, locationSearch, context),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: modeColor),
|
||||
child: Text(_getConfirmLabel(locationSearch, context),
|
||||
child: Text(
|
||||
_getConfirmLabel(locationSearch, context),
|
||||
style: const TextStyle(color: Colors.white)),
|
||||
),
|
||||
),
|
||||
@@ -778,16 +789,18 @@ class _MapPickerOverlay extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _onConfirmTap(
|
||||
MapEngineController mapEngine, LocationSearchController locationSearch, BuildContext context) async {
|
||||
Future<void> _onConfirmTap(MapEngineController mapEngine,
|
||||
LocationSearchController locationSearch, BuildContext context) async {
|
||||
final rideLifecycle = Get.find<RideLifecycleController>();
|
||||
Log.print(
|
||||
'🔘 _onConfirmTap: isPickingWaypoint=${locationSearch.isPickingWaypoint}, newMyLocation=${locationSearch.newMyLocation}');
|
||||
await Future.delayed(const Duration(milliseconds: 280));
|
||||
final LatLng currentCameraPosition = LatLng(
|
||||
locationSearch.newMyLocation.latitude, locationSearch.newMyLocation.longitude);
|
||||
locationSearch.newMyLocation.latitude,
|
||||
locationSearch.newMyLocation.longitude);
|
||||
|
||||
if (locationSearch.isPickingWaypoint && locationSearch.pickingWaypointIndex >= 0) {
|
||||
if (locationSearch.isPickingWaypoint &&
|
||||
locationSearch.pickingWaypointIndex >= 0) {
|
||||
locationSearch.setMenuWaypointFromMap(
|
||||
locationSearch.pickingWaypointIndex, currentCameraPosition);
|
||||
mySnackbarSuccess('Waypoint has been set successfully'.tr);
|
||||
@@ -810,7 +823,8 @@ class _MapPickerOverlay extends StatelessWidget {
|
||||
mapEngine.mainBottomMenuMapHeight = Get.height * .22;
|
||||
mapEngine.update();
|
||||
locationSearch.update();
|
||||
await rideLifecycle.getDirectionMap('${start.latitude},${start.longitude}',
|
||||
await rideLifecycle.getDirectionMap(
|
||||
'${start.latitude},${start.longitude}',
|
||||
'${locationSearch.myDestination.latitude},${locationSearch.myDestination.longitude}');
|
||||
rideLifecycle.showBottomSheet1();
|
||||
return;
|
||||
@@ -953,7 +967,8 @@ class _RecentPlaceChip extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.history_rounded,
|
||||
size: 14, color: AppColor.primaryColor.withValues(alpha: 0.7)),
|
||||
size: 14,
|
||||
color: AppColor.primaryColor.withValues(alpha: 0.7)),
|
||||
const SizedBox(width: 7),
|
||||
Text(place['name'] ?? '',
|
||||
style: TextStyle(
|
||||
@@ -1147,8 +1162,8 @@ class FaviouratePlacesDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
confirm:
|
||||
MyElevatedButton(title: 'Back'.tr, onPressed: () => Get.back()),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Back'.tr, onPressed: () => Get.back()),
|
||||
);
|
||||
},
|
||||
child: Padding(
|
||||
|
||||
Reference in New Issue
Block a user