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
@@ -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,
),
),
],
),
],
),
),
);
}
}