9/13/3
This commit is contained in:
@@ -23,6 +23,7 @@ class FirebasMessagesController extends GetxController {
|
||||
|
||||
List<String> tokens = [];
|
||||
List dataTokens = [];
|
||||
late String driverID;
|
||||
NotificationSettings? notificationSettings;
|
||||
@override
|
||||
void onInit() async {
|
||||
@@ -110,103 +111,13 @@ class FirebasMessagesController extends GetxController {
|
||||
'DriverList': myList,
|
||||
'body': message.notification!.body
|
||||
});
|
||||
// Get.defaultDialog(
|
||||
// barrierDismissible: false,
|
||||
// title: message.notification!.title.toString(),
|
||||
// content: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// // Text(message.notification!.body.toString()),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: TextButton.icon(
|
||||
// onPressed: () {
|
||||
// String mapUrl =
|
||||
// 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
|
||||
// print(mapUrl);
|
||||
// launchUrl1(mapUrl);
|
||||
// },
|
||||
// icon: const Icon(Icons.map),
|
||||
// label: Text('Rouats of Trip'.tr)),
|
||||
// ),
|
||||
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: Text(
|
||||
// 'Tatal From Passenger is '.tr +
|
||||
// double.parse(myList[2]).toStringAsFixed(2),
|
||||
// style: AppStyle.title,
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: Text(
|
||||
// 'Tatal For You is '.tr +
|
||||
// double.parse(myList[3]).toStringAsFixed(2),
|
||||
// style: AppStyle.title,
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: Text(
|
||||
// 'Distance is '.tr + myList[5].toString() + ' KM'.tr,
|
||||
// style: AppStyle.title,
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: Text(
|
||||
// 'Duration of Trip is '.tr +
|
||||
// myList[4].toString() +
|
||||
// ' Minutes'.tr,
|
||||
// style: AppStyle.title,
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// MyElevatedButton(
|
||||
// title: 'Apply Order'.tr,
|
||||
// onPressed: () async {
|
||||
// await CRUD().postFromDialogue(
|
||||
// link: AppLink.addDriverOrder,
|
||||
// payload: {
|
||||
// 'driver_id': myList[6].toString(),
|
||||
// // box.read(BoxName.driverID).toString(),
|
||||
// 'order_id':
|
||||
// message.notification!.body.toString(),
|
||||
// 'status': 'Apply'
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// MyElevatedButton(
|
||||
// title: 'Refuse Order'.tr,
|
||||
// onPressed: () async {
|
||||
// await CRUD().postFromDialogue(
|
||||
// link: AppLink.addDriverOrder,
|
||||
// payload: {
|
||||
// 'driver_id': myList[6].toString(),
|
||||
// // box.read(BoxName.driverID).toString(),
|
||||
// 'order_id':
|
||||
// message.notification!.body.toString(),
|
||||
// 'status': 'Refused'
|
||||
// });
|
||||
// },
|
||||
// kolor: AppColor.redColor,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ));
|
||||
} else if (message.notification!.title!.contains('Apply Ride')) {
|
||||
// MapController().rideConfirm = true;
|
||||
var passengerList = message.data['passengerList'];
|
||||
print(passengerList);
|
||||
print('9999999999999my Apply Ride 999999999999999');
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
driverID = myList[2].toString();
|
||||
Get.snackbar(
|
||||
'Captin Applied the Ride for You'.tr,
|
||||
'message',
|
||||
@@ -266,25 +177,6 @@ class FirebasMessagesController extends GetxController {
|
||||
overlayColor: AppColor.primaryColor.withOpacity(0.5),
|
||||
userInputForm: null,
|
||||
);
|
||||
|
||||
// Get.defaultDialog(
|
||||
// barrierDismissible: false,
|
||||
// title: message.notification!.title.toString(),
|
||||
// content: Row(
|
||||
// children: [Text(myList[1].toString())],
|
||||
// ),
|
||||
// confirm: MyElevatedButton(
|
||||
// title: 'Ok',
|
||||
// onPressed: () {
|
||||
// // MapController().rideConfirm = true;
|
||||
// },
|
||||
// ),
|
||||
// cancel: MyElevatedButton(
|
||||
// title: 'Cancel',
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// ));
|
||||
} else if (message.notification!.title!.contains('Promo')) {
|
||||
Get.to(const PromosPassengerPage());
|
||||
}
|
||||
|
||||
@@ -83,20 +83,24 @@ class CRUD {
|
||||
},
|
||||
);
|
||||
print(response.request);
|
||||
print('body=========================');
|
||||
print(response.body);
|
||||
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
if (jsonData['status'] == 'success') {
|
||||
Get.back();
|
||||
Get.snackbar(
|
||||
jsonData['status'],
|
||||
jsonData['message'],
|
||||
);
|
||||
if (response.body.isNotEmpty) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
if (jsonData['status'] == 'success') {
|
||||
Get.back();
|
||||
Get.snackbar(
|
||||
jsonData['status'],
|
||||
jsonData['message'],
|
||||
);
|
||||
|
||||
return response.body;
|
||||
return response.body;
|
||||
}
|
||||
}
|
||||
return (jsonData['status']);
|
||||
}
|
||||
return (jsonData['status']);
|
||||
}
|
||||
|
||||
Future<dynamic> getGoogleApi({
|
||||
|
||||
@@ -63,7 +63,7 @@ class MapController extends GetxController {
|
||||
int selectedPassengerCount = 1;
|
||||
double progress = 0;
|
||||
int durationTimer = 25;
|
||||
int remainingTime = 0;
|
||||
int remainingTime = 25;
|
||||
|
||||
void onChangedPassengerCount(int newValue) {
|
||||
selectedPassengerCount = newValue;
|
||||
@@ -129,12 +129,13 @@ class MapController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
var rideId;
|
||||
changeConfirmRide() async {
|
||||
rideConfirm = true;
|
||||
shouldFetch = true;
|
||||
update();
|
||||
// print('rideConfirm= $rideConfirm');
|
||||
var rideId;
|
||||
|
||||
await getCarsLocationByPassenger();
|
||||
await CRUD().post(link: AppLink.addRides, payload: {
|
||||
"start_location": '${data[0]['start_address']}',
|
||||
@@ -226,6 +227,8 @@ class MapController extends GetxController {
|
||||
void timerEnded() async {
|
||||
print('Timer ended');
|
||||
// refuseOrder();
|
||||
isCancelRidePageShown = false;
|
||||
update();
|
||||
}
|
||||
|
||||
Future<String> getRideStatus(int rideId) async {
|
||||
@@ -251,12 +254,16 @@ class MapController extends GetxController {
|
||||
data = [];
|
||||
rideConfirm = false;
|
||||
changeCancelRidePageShow();
|
||||
remainingTime = 25;
|
||||
update();
|
||||
|
||||
await CRUD().post(link: AppLink.addCancelRide, payload: {
|
||||
"driverID": "1", // Convert to String
|
||||
await CRUD().post(link: AppLink.addCancelRideFromPassenger, payload: {
|
||||
"driverID": FirebasMessagesController()
|
||||
.driverID
|
||||
.toString(), // Convert to String
|
||||
"passengerID":
|
||||
box.read(BoxName.pasengerID).toString(), // Convert to String
|
||||
"rideID": "222", // Convert to String
|
||||
"rideID": rideId.toString(), // Convert to String
|
||||
"note": cancelNote
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user