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
@@ -808,25 +808,85 @@ class RideLifecycleController extends GetxController {
/// ‏خطأ تجربة سيئة، ومنعها من الأساس أوضح.
Future<DateTime?> _pickScheduleTime(ScheduledRidesController ctrl) async {
final now = DateTime.now();
DateTime tempPickedDate = ctrl.earliest;
final date = await showDatePicker(
final picked = await showModalBottomSheet<DateTime>(
context: Get.context!,
initialDate: ctrl.earliest,
firstDate: now,
lastDate: ctrl.latest,
helpText: 'موعد الرحلة'.tr,
);
if (date == null) return null;
backgroundColor: Colors.transparent,
builder: (BuildContext context) {
final isDark = Get.isDarkMode;
final bgColor = isDark ? const Color(0xFF1E1E1E) : Colors.white;
final primaryColor = AppColor.primaryColor;
final time = await showTimePicker(
context: Get.context!,
initialTime: TimeOfDay.fromDateTime(ctrl.earliest),
helpText: 'وقت الانطلاق'.tr,
return Container(
height: 320,
decoration: BoxDecoration(
color: bgColor,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
),
child: Column(
children: [
// Header
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: isDark ? Colors.white12 : Colors.black12,
width: 1,
),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TextButton(
onPressed: () => Navigator.pop(context),
child: Text(
'Cancel'.tr,
style: TextStyle(color: Colors.redAccent, fontSize: 16),
),
),
TextButton(
onPressed: () => Navigator.pop(context, tempPickedDate),
child: Text(
'Confirm'.tr,
style: TextStyle(
color: primaryColor,
fontSize: 16,
fontWeight: FontWeight.bold),
),
),
],
),
),
// Cupertino Picker
Expanded(
child: CupertinoTheme(
data: CupertinoThemeData(
brightness: isDark ? Brightness.dark : Brightness.light,
),
child: CupertinoDatePicker(
mode: CupertinoDatePickerMode.dateAndTime,
initialDateTime: ctrl.earliest,
minimumDate: now,
maximumDate: ctrl.latest,
use24hFormat: false,
onDateTimeChanged: (DateTime newDateTime) {
tempPickedDate = newDateTime;
},
),
),
),
],
),
);
},
);
if (time == null) return null;
final picked =
DateTime(date.year, date.month, date.day, time.hour, time.minute);
if (picked == null) return null;
// ‏منتقي التاريخ يحصر اليوم لا الساعة، فقد يختار الراكب يوماً صالحاً
// ‏بساعة ماضية أو قريبة جداً.