Update: 2026-08-07 14:20:27

This commit is contained in:
Hamza-Ayed
2026-08-07 14:20:27 +03:00
parent 9e186f9ff3
commit b2a95c53aa
13 changed files with 343 additions and 58 deletions
@@ -1,5 +1,3 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
@@ -17,7 +15,6 @@ import 'package:siro_driver/views/auth/captin/invite_driver_screen.dart';
import 'package:siro_driver/views/home/statistics/statistics_dashboard.dart';
import 'package:siro_driver/views/gamification/challenges_page.dart';
import 'package:siro_driver/views/gamification/leaderboard_page.dart';
import 'package:siro_driver/views/gamification/referral_center_page.dart';
import 'package:siro_driver/views/home/journal/schedule_page.dart';
import 'package:siro_driver/views/notification/available_rides_page.dart';
import 'package:siro_driver/views/auth/captin/logout_captain.dart';
@@ -30,10 +27,8 @@ import 'package:siro_driver/views/notification/notification_captain.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../../../constant/colors.dart';
import '../About Us/video_page.dart';
import '../assurance_health_page.dart';
import '../maintain_center_page.dart';
import '../../../transit/transit_driver_home_page.dart';
import '../../../food_delivery/food_delivery_home_page.dart';
import '../../journal/driver_scheduled_rides_page.dart';
// 1. إنشاء Class لتعريف بيانات كل عنصر في القائمة
class DrawerItem {
@@ -87,6 +82,11 @@ class AppDrawer extends StatelessWidget {
icon: Icons.calendar_today_rounded,
color: Colors.teal,
onTap: () => Get.to(() => SchedulePage())),
DrawerItem(
title: 'الرحلات المجدولة القادمة'.tr, // or 'Reserved Rides'
icon: Icons.edit_calendar_rounded,
color: Colors.orangeAccent,
onTap: () => Get.to(() => const DriverScheduledRidesPage())),
DrawerItem(
title: 'Leaderboard'.tr,
icon: Icons.leaderboard_rounded,
@@ -326,10 +326,9 @@ class UserHeader extends StatelessWidget {
fontSize: 18,
shadows: [Shadow(blurRadius: 2, color: Colors.black26)]),
),
accountEmail:
box.read(BoxName.emailDriver).toString().contains('siroapp')
? Text('Your email not updated yet'.tr)
: Text(box.read(BoxName.emailDriver)),
accountEmail: box.read(BoxName.emailDriver).toString().contains('siroapp')
? Text('Your email not updated yet'.tr)
: Text(box.read(BoxName.emailDriver)),
currentAccountPicture: GetBuilder<ImageController>(
builder: (controller) => Stack(
clipBehavior: Clip.none,
@@ -339,7 +338,8 @@ class UserHeader extends StatelessWidget {
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 2),
boxShadow: [
BoxShadow(color: Colors.black.withValues(alpha: 0.3), blurRadius: 5)
BoxShadow(
color: Colors.black.withValues(alpha: 0.3), blurRadius: 5)
],
),
child: controller.isloading
@@ -0,0 +1,128 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../controller/scheduled/driver_scheduled_rides_controller.dart';
import '../../../constant/colors.dart';
class DriverScheduledRidesPage extends StatelessWidget {
const DriverScheduledRidesPage({super.key});
@override
Widget build(BuildContext context) {
final controller = Get.put(DriverScheduledRidesController());
return Scaffold(
appBar: AppBar(
title: Text('Upcoming Scheduled Rides'.tr),
centerTitle: true,
),
body: Obx(() {
if (controller.isLoading.value) {
return const Center(child: CircularProgressIndicator());
}
if (controller.bookings.isEmpty) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.calendar_month,
size: 80, color: Colors.grey.shade400),
const SizedBox(height: 16),
Text(
'You have no upcoming scheduled rides'.tr,
style: const TextStyle(fontSize: 18, color: Colors.grey),
),
],
),
);
}
return RefreshIndicator(
onRefresh: controller.fetch,
child: ListView.builder(
padding: const EdgeInsets.all(12),
itemCount: controller.bookings.length,
itemBuilder: (context, index) {
final booking = controller.bookings[index];
return _buildBookingCard(booking, context);
},
),
);
}),
);
}
Widget _buildBookingCard(Map<String, dynamic> booking, BuildContext context) {
return Card(
margin: const EdgeInsets.only(bottom: 12),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
elevation: 2,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: AppColor.primaryColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(20),
),
child: Row(
children: [
const Icon(Icons.access_time,
size: 16, color: AppColor.primaryColor),
const SizedBox(width: 6),
Text(
booking['scheduled_at'] ?? '',
style: const TextStyle(
color: AppColor.primaryColor,
fontWeight: FontWeight.bold),
),
],
),
),
Text(
'${booking['estimated_price']} ${'Currency'.tr}',
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 16),
),
],
),
const SizedBox(height: 16),
Row(
children: [
const Icon(Icons.my_location, color: Colors.green, size: 20),
const SizedBox(width: 8),
Expanded(
child: Text(
booking['start_name'] ?? 'Starting Point'.tr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.location_on, color: Colors.red, size: 20),
const SizedBox(width: 8),
Expanded(
child: Text(
booking['end_name'] ?? 'Destination'.tr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
],
),
),
);
}
}