26-1-20/1
This commit is contained in:
@@ -17,6 +17,7 @@ import '../../../../constant/box_name.dart';
|
||||
import '../../../../constant/colors.dart';
|
||||
import '../../../../constant/info.dart';
|
||||
import '../../../../constant/style.dart';
|
||||
import '../../../../controller/functions/location_background_controller.dart';
|
||||
import '../../../../controller/functions/location_controller.dart';
|
||||
import '../../../../controller/functions/overlay_permisssion.dart';
|
||||
import '../../../../controller/functions/package_info.dart';
|
||||
@@ -44,29 +45,33 @@ class HomeCaptain extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
// Initial calls remain the same.
|
||||
// Get.put(HomeCaptainController());
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
closeOverlayIfFound();
|
||||
checkForUpdate(context);
|
||||
getPermissionOverlay();
|
||||
showDriverGiftClaim(context);
|
||||
checkForAppliedRide(context);
|
||||
});
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
print("🔥 HomeCaptain postFrameCallback started"); // Debug
|
||||
await closeOverlayIfFound();
|
||||
await checkForUpdate(context);
|
||||
await getPermissionOverlay();
|
||||
await showDriverGiftClaim(context);
|
||||
await checkForAppliedRide(context);
|
||||
print("✅ postFrameCallback completed");
|
||||
});
|
||||
// The stack is now even simpler.
|
||||
return Scaffold(
|
||||
appBar: const _HomeAppBar(),
|
||||
drawer: AppDrawer(),
|
||||
body: Stack(
|
||||
children: [
|
||||
// 1. The Map View is the base layer.
|
||||
const _MapView(),
|
||||
body: SafeArea(
|
||||
child: Stack(
|
||||
children: [
|
||||
// 1. The Map View is the base layer.
|
||||
const _MapView(),
|
||||
|
||||
// 2. The new floating "Status Pod" at the bottom.
|
||||
const _StatusPodOverlay(),
|
||||
FloatingActionButtons(),
|
||||
// This widget from the original code remains.
|
||||
leftMainMenuCaptainIcons(),
|
||||
],
|
||||
// 2. The new floating "Status Pod" at the bottom.
|
||||
const _StatusPodOverlay(),
|
||||
FloatingActionButtons(),
|
||||
// This widget from the original code remains.
|
||||
leftMainMenuCaptainIcons(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -139,12 +144,12 @@ class _HomeAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
tooltip: 'Change Map Type'.tr,
|
||||
onPressed: homeCaptainController.changeMapType,
|
||||
),
|
||||
_MapControlButton(
|
||||
iconColor: Colors.blue,
|
||||
icon: Icons.streetview_sharp,
|
||||
tooltip: 'Toggle Traffic'.tr,
|
||||
onPressed: homeCaptainController.changeMapTraffic,
|
||||
),
|
||||
// _MapControlButton(
|
||||
// iconColor: Colors.blue,
|
||||
// icon: Icons.streetview_sharp,
|
||||
// tooltip: 'Toggle Traffic'.tr,
|
||||
// onPressed: homeCaptainController.changeMapTraffic,
|
||||
// ),
|
||||
GetBuilder<HomeCaptainController>(
|
||||
builder: (controller) {
|
||||
return _MapControlButton(
|
||||
@@ -250,6 +255,7 @@ class _MapView extends StatelessWidget {
|
||||
// --- تم حذف onCameraMove الخاطئ ---
|
||||
// === إضافة الطبقة الحرارية هنا ===
|
||||
polygons: controller.heatmapPolygons,
|
||||
|
||||
// =
|
||||
markers: {
|
||||
Marker(
|
||||
@@ -346,9 +352,10 @@ class _MapView extends StatelessWidget {
|
||||
class _StatusPodOverlay extends StatelessWidget {
|
||||
const _StatusPodOverlay();
|
||||
|
||||
void _showDetailsDialog(BuildContext context) {
|
||||
void _showDetailsDialog(
|
||||
BuildContext context, HomeCaptainController controller) {
|
||||
Get.dialog(
|
||||
const _DriverDetailsDialog(),
|
||||
_DriverDetailsDialog(controller), // تمرير الكنترولر هنا
|
||||
barrierColor: Colors.black.withOpacity(0.3),
|
||||
);
|
||||
}
|
||||
@@ -361,7 +368,7 @@ class _StatusPodOverlay extends StatelessWidget {
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: GestureDetector(
|
||||
onTap: () => _showDetailsDialog(context),
|
||||
onTap: () => _showDetailsDialog(context, homeCaptainController),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
child: BackdropFilter(
|
||||
@@ -435,11 +442,16 @@ class _StatusPodOverlay extends StatelessWidget {
|
||||
|
||||
/// 4. The Dialog that shows detailed driver stats.
|
||||
class _DriverDetailsDialog extends StatelessWidget {
|
||||
const _DriverDetailsDialog();
|
||||
// 1. إضافة متغير للكنترولر
|
||||
final HomeCaptainController controller;
|
||||
|
||||
// 2. تحديث البناء لاستقباله
|
||||
const _DriverDetailsDialog(this.controller);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final homeCaptainController = Get.find<HomeCaptainController>();
|
||||
// 3. حذف السطر الذي يسبب الخطأ: final homeCaptainController = Get.find...
|
||||
|
||||
return BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
||||
child: AlertDialog(
|
||||
@@ -463,27 +475,28 @@ class _DriverDetailsDialog extends StatelessWidget {
|
||||
icon: Entypo.wallet,
|
||||
color: AppColor.greenColor,
|
||||
label: 'Today'.tr,
|
||||
value: homeCaptainController.totalMoneyToday.toString(),
|
||||
// استخدام المتغير controller الذي تم تمريره
|
||||
value: controller.totalMoneyToday.toString(),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildStatRow(
|
||||
icon: Entypo.wallet,
|
||||
color: AppColor.yellowColor,
|
||||
label: AppInformation.appName,
|
||||
value: homeCaptainController.totalMoneyInSEFER.toString(),
|
||||
value: controller.totalMoneyInSEFER.toString(),
|
||||
),
|
||||
const Divider(height: 24),
|
||||
_buildDurationRow(
|
||||
icon: Icons.timer_outlined,
|
||||
label: 'Active Duration:'.tr,
|
||||
value: homeCaptainController.stringActiveDuration,
|
||||
value: controller.stringActiveDuration,
|
||||
color: AppColor.greenColor,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildDurationRow(
|
||||
icon: Icons.access_time,
|
||||
label: 'Total Connection Duration:'.tr,
|
||||
value: homeCaptainController.totalDurationToday,
|
||||
value: controller.totalDurationToday,
|
||||
color: AppColor.accentColor,
|
||||
),
|
||||
const Divider(height: 24),
|
||||
@@ -491,7 +504,7 @@ class _DriverDetailsDialog extends StatelessWidget {
|
||||
icon: Icons.star_border_rounded,
|
||||
color: AppColor.blueColor,
|
||||
label: 'Total Points'.tr,
|
||||
value: homeCaptainController.totalPoints.toString(),
|
||||
value: controller.totalPoints.toString(),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -508,6 +521,7 @@ class _DriverDetailsDialog extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// ... بقية الدوال المساعدة (_buildStatRow, _buildDurationRow) تبقى كما هي ...
|
||||
Widget _buildStatRow(
|
||||
{required IconData icon,
|
||||
required Color color,
|
||||
|
||||
Reference in New Issue
Block a user