7/23/2
This commit is contained in:
@@ -3,16 +3,13 @@ import 'package:SEFER/controller/home/map_passenger_controller.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../constant/api_key.dart';
|
||||
|
||||
class CupertinoDriverListWidget extends StatelessWidget {
|
||||
final List drivers;
|
||||
|
||||
const CupertinoDriverListWidget({super.key, required this.drivers});
|
||||
|
||||
MapPassengerController mapPassengerController =
|
||||
Get.put(MapPassengerController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
@@ -21,10 +18,10 @@ class CupertinoDriverListWidget extends StatelessWidget {
|
||||
),
|
||||
child: SafeArea(
|
||||
child: ListView.separated(
|
||||
itemCount: drivers.length,
|
||||
itemCount: mapPassengerController.driversForMishwari.length,
|
||||
separatorBuilder: (context, index) => const Divider(height: 1),
|
||||
itemBuilder: (context, index) {
|
||||
var driver = drivers[index];
|
||||
var driver = mapPassengerController.driversForMishwari[index];
|
||||
return Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: CupertinoListTile(
|
||||
@@ -137,7 +134,7 @@ class CupertinoDriverListWidget extends StatelessWidget {
|
||||
title: 'OK'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
showDateTimePickerDialog();
|
||||
showDateTimePickerDialog(driver);
|
||||
}));
|
||||
print('${'Selected driver'.tr}: ${driver['NAME']}');
|
||||
// Get.back(); // Close the dialog
|
||||
@@ -186,13 +183,13 @@ class CupertinoDriverListWidget extends StatelessWidget {
|
||||
title: 'OK'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
showDateTimePickerDialog();
|
||||
showDateTimePickerDialog(driver);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showDateTimePickerDialog() {
|
||||
void showDateTimePickerDialog(Map<String, dynamic> driver) {
|
||||
DateTime selectedDateTime = DateTime.now();
|
||||
|
||||
Get.defaultDialog(
|
||||
@@ -211,10 +208,10 @@ class CupertinoDriverListWidget extends StatelessWidget {
|
||||
title: 'Confirm Trip'.tr,
|
||||
onPressed: () async {
|
||||
DateTime selectedDateTime =
|
||||
Get.find<MapPassengerController>().selectedDateTime.value;
|
||||
mapPassengerController.selectedDateTime.value;
|
||||
// Save trip data and set up notifications
|
||||
// await Get.find<MapPassengerController>().saveTripData(driver, selectedDateTime);
|
||||
Get.back();
|
||||
await mapPassengerController.saveTripData(driver, selectedDateTime);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -258,28 +255,3 @@ class DateTimePickerWidget extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Future<void> setLocalNotification(DateTime tripDateTime) async {
|
||||
// FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||
// FlutterLocalNotificationsPlugin();
|
||||
|
||||
// var androidPlatformChannelSpecifics = const AndroidNotificationDetails(
|
||||
// 'trip_reminder_channel',
|
||||
// 'Trip Reminders',
|
||||
// importance: Importance.max,
|
||||
// priority: Priority.high,
|
||||
// );
|
||||
// var iOSPlatformChannelSpecifics = IOSNotificationDetails();
|
||||
// var platformChannelSpecifics = NotificationDetails(
|
||||
// android: androidPlatformChannelSpecifics,
|
||||
// iOS: iOSPlatformChannelSpecifics,
|
||||
// );
|
||||
|
||||
// await flutterLocalNotificationsPlugin.schedule(
|
||||
// 0,
|
||||
// 'Trip Reminder'.tr,
|
||||
// 'Your trip is scheduled in 30 minutes'.tr,
|
||||
// tripDateTime.subtract(const Duration(minutes: 30)),
|
||||
// platformChannelSpecifics,
|
||||
// );
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user