25-10-11/1
This commit is contained in:
@@ -45,6 +45,7 @@ class HomeCaptain extends StatelessWidget {
|
||||
checkForUpdate(context);
|
||||
getPermissionOverlay();
|
||||
showDriverGiftClaim(context);
|
||||
checkForAppliedRide(context);
|
||||
});
|
||||
|
||||
// The stack is now even simpler.
|
||||
@@ -187,11 +188,38 @@ class _MapView extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final locationController = Get.find<LocationController>();
|
||||
return GetBuilder<HomeCaptainController>(builder: (controller) {
|
||||
return controller.isLoading
|
||||
? const MyCircularProgressIndicator()
|
||||
: GoogleMap(
|
||||
// جلب الكونترولر الرئيسي
|
||||
final homeController = Get.find<HomeCaptainController>();
|
||||
|
||||
return GetBuilder<HomeCaptainController>(
|
||||
builder: (controller) {
|
||||
if (controller.isLoading) {
|
||||
return const MyCircularProgressIndicator();
|
||||
}
|
||||
|
||||
// --- هذا هو التعديل ---
|
||||
// هذا الـ Builder يستمع إلى تحديثات الموقع
|
||||
return GetBuilder<LocationController>(
|
||||
builder: (locationController) {
|
||||
// --- هذا هو الكود الجديد ---
|
||||
// نقوم بتحريك الكاميرا يدوياً عند كل تحديث للموقع
|
||||
if (homeController.mapHomeCaptainController != null &&
|
||||
homeController.isActive) {
|
||||
homeController.mapHomeCaptainController!.animateCamera(
|
||||
CameraUpdate.newCameraPosition(
|
||||
CameraPosition(
|
||||
target: locationController.myLocation, // الموقع الجديد
|
||||
zoom: 17.5, // تقريب لمتابعة السائق
|
||||
tilt: 50.0, // زاوية رؤية 3D
|
||||
bearing: locationController.heading, // اتجاه السيارة
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
// --- نهاية الكود الجديد ---
|
||||
|
||||
// إرجاع الخريطة
|
||||
return GoogleMap(
|
||||
padding: const EdgeInsets.only(bottom: 110, top: 300),
|
||||
fortyFiveDegreeImageryEnabled: true,
|
||||
onMapCreated: controller.onMapCreated,
|
||||
@@ -200,19 +228,12 @@ class _MapView extends StatelessWidget {
|
||||
target: locationController.myLocation,
|
||||
zoom: 15,
|
||||
),
|
||||
onCameraMove: (position) {
|
||||
CameraPosition(
|
||||
target: locationController.myLocation,
|
||||
zoom: 17.5,
|
||||
tilt: 50.0,
|
||||
bearing: locationController.heading,
|
||||
);
|
||||
},
|
||||
// --- تم حذف onCameraMove الخاطئ ---
|
||||
markers: {
|
||||
Marker(
|
||||
markerId: MarkerId('MyLocation'.tr),
|
||||
position: locationController.myLocation,
|
||||
rotation: locationController.heading,
|
||||
position: locationController.myLocation, // يتم تحديثه من هنا
|
||||
rotation: locationController.heading, // يتم تحديثه من هنا
|
||||
flat: true,
|
||||
anchor: const Offset(0.5, 0.5),
|
||||
icon: controller.carIcon,
|
||||
@@ -222,12 +243,15 @@ class _MapView extends StatelessWidget {
|
||||
myLocationButtonEnabled: false,
|
||||
myLocationEnabled: false,
|
||||
trafficEnabled: controller.mapTrafficON,
|
||||
buildingsEnabled: true,
|
||||
buildingsEnabled: false,
|
||||
mapToolbarEnabled: false,
|
||||
compassEnabled: true,
|
||||
compassEnabled: false,
|
||||
zoomControlsEnabled: false,
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,3 +605,7 @@ class FloatingActionButtons extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> checkForAppliedRide(BuildContext context) async {
|
||||
checkForPendingOrderFromServer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user