9/13/3
This commit is contained in:
@@ -28,7 +28,8 @@ class AppLink {
|
|||||||
|
|
||||||
////=======================cancelRide===================
|
////=======================cancelRide===================
|
||||||
static const String ride = '$server/ride';
|
static const String ride = '$server/ride';
|
||||||
static const String addCancelRide = "$server/ride/cancelRide/add.php";
|
static const String addCancelRideFromPassenger =
|
||||||
|
"$server/ride/cancelRide/add.php";
|
||||||
static const String cancelRide = "$server/ride/cancelRide/get.php";
|
static const String cancelRide = "$server/ride/cancelRide/get.php";
|
||||||
//-----------------ridessss------------------
|
//-----------------ridessss------------------
|
||||||
static const String addRides = "$ride/rides/add.php";
|
static const String addRides = "$ride/rides/add.php";
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class FirebasMessagesController extends GetxController {
|
|||||||
|
|
||||||
List<String> tokens = [];
|
List<String> tokens = [];
|
||||||
List dataTokens = [];
|
List dataTokens = [];
|
||||||
|
late String driverID;
|
||||||
NotificationSettings? notificationSettings;
|
NotificationSettings? notificationSettings;
|
||||||
@override
|
@override
|
||||||
void onInit() async {
|
void onInit() async {
|
||||||
@@ -110,103 +111,13 @@ class FirebasMessagesController extends GetxController {
|
|||||||
'DriverList': myList,
|
'DriverList': myList,
|
||||||
'body': message.notification!.body
|
'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')) {
|
} else if (message.notification!.title!.contains('Apply Ride')) {
|
||||||
// MapController().rideConfirm = true;
|
// MapController().rideConfirm = true;
|
||||||
var passengerList = message.data['passengerList'];
|
var passengerList = message.data['passengerList'];
|
||||||
print(passengerList);
|
print(passengerList);
|
||||||
print('9999999999999my Apply Ride 999999999999999');
|
print('9999999999999my Apply Ride 999999999999999');
|
||||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||||
|
driverID = myList[2].toString();
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
'Captin Applied the Ride for You'.tr,
|
'Captin Applied the Ride for You'.tr,
|
||||||
'message',
|
'message',
|
||||||
@@ -266,25 +177,6 @@ class FirebasMessagesController extends GetxController {
|
|||||||
overlayColor: AppColor.primaryColor.withOpacity(0.5),
|
overlayColor: AppColor.primaryColor.withOpacity(0.5),
|
||||||
userInputForm: null,
|
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')) {
|
} else if (message.notification!.title!.contains('Promo')) {
|
||||||
Get.to(const PromosPassengerPage());
|
Get.to(const PromosPassengerPage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,20 +83,24 @@ class CRUD {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
print(response.request);
|
print(response.request);
|
||||||
|
print('body=========================');
|
||||||
|
print(response.body);
|
||||||
|
|
||||||
var jsonData = jsonDecode(response.body);
|
if (response.body.isNotEmpty) {
|
||||||
if (response.statusCode == 200) {
|
var jsonData = jsonDecode(response.body);
|
||||||
if (jsonData['status'] == 'success') {
|
if (response.statusCode == 200) {
|
||||||
Get.back();
|
if (jsonData['status'] == 'success') {
|
||||||
Get.snackbar(
|
Get.back();
|
||||||
jsonData['status'],
|
Get.snackbar(
|
||||||
jsonData['message'],
|
jsonData['status'],
|
||||||
);
|
jsonData['message'],
|
||||||
|
);
|
||||||
|
|
||||||
return response.body;
|
return response.body;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return (jsonData['status']);
|
||||||
}
|
}
|
||||||
return (jsonData['status']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> getGoogleApi({
|
Future<dynamic> getGoogleApi({
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class MapController extends GetxController {
|
|||||||
int selectedPassengerCount = 1;
|
int selectedPassengerCount = 1;
|
||||||
double progress = 0;
|
double progress = 0;
|
||||||
int durationTimer = 25;
|
int durationTimer = 25;
|
||||||
int remainingTime = 0;
|
int remainingTime = 25;
|
||||||
|
|
||||||
void onChangedPassengerCount(int newValue) {
|
void onChangedPassengerCount(int newValue) {
|
||||||
selectedPassengerCount = newValue;
|
selectedPassengerCount = newValue;
|
||||||
@@ -129,12 +129,13 @@ class MapController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rideId;
|
||||||
changeConfirmRide() async {
|
changeConfirmRide() async {
|
||||||
rideConfirm = true;
|
rideConfirm = true;
|
||||||
shouldFetch = true;
|
shouldFetch = true;
|
||||||
update();
|
update();
|
||||||
// print('rideConfirm= $rideConfirm');
|
// print('rideConfirm= $rideConfirm');
|
||||||
var rideId;
|
|
||||||
await getCarsLocationByPassenger();
|
await getCarsLocationByPassenger();
|
||||||
await CRUD().post(link: AppLink.addRides, payload: {
|
await CRUD().post(link: AppLink.addRides, payload: {
|
||||||
"start_location": '${data[0]['start_address']}',
|
"start_location": '${data[0]['start_address']}',
|
||||||
@@ -226,6 +227,8 @@ class MapController extends GetxController {
|
|||||||
void timerEnded() async {
|
void timerEnded() async {
|
||||||
print('Timer ended');
|
print('Timer ended');
|
||||||
// refuseOrder();
|
// refuseOrder();
|
||||||
|
isCancelRidePageShown = false;
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> getRideStatus(int rideId) async {
|
Future<String> getRideStatus(int rideId) async {
|
||||||
@@ -251,12 +254,16 @@ class MapController extends GetxController {
|
|||||||
data = [];
|
data = [];
|
||||||
rideConfirm = false;
|
rideConfirm = false;
|
||||||
changeCancelRidePageShow();
|
changeCancelRidePageShow();
|
||||||
|
remainingTime = 25;
|
||||||
|
update();
|
||||||
|
|
||||||
await CRUD().post(link: AppLink.addCancelRide, payload: {
|
await CRUD().post(link: AppLink.addCancelRideFromPassenger, payload: {
|
||||||
"driverID": "1", // Convert to String
|
"driverID": FirebasMessagesController()
|
||||||
|
.driverID
|
||||||
|
.toString(), // Convert to String
|
||||||
"passengerID":
|
"passengerID":
|
||||||
box.read(BoxName.pasengerID).toString(), // Convert to String
|
box.read(BoxName.pasengerID).toString(), // Convert to String
|
||||||
"rideID": "222", // Convert to String
|
"rideID": rideId.toString(), // Convert to String
|
||||||
"note": cancelNote
|
"note": cancelNote
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -184,13 +184,13 @@ class LoginPage extends StatelessWidget {
|
|||||||
displayFullTextOnTap: true,
|
displayFullTextOnTap: true,
|
||||||
stopPauseOnTap: true,
|
stopPauseOnTap: true,
|
||||||
),
|
),
|
||||||
// GestureDetector(
|
GestureDetector(
|
||||||
// onTap: () => Get.to(LoginCaptin()),
|
onTap: () => Get.to(LoginCaptin()),
|
||||||
// child: Text(
|
child: Text(
|
||||||
// 'If You Want be Captin Click Here.'.tr,
|
'If You Want be Captin Click Here.'.tr,
|
||||||
// style: AppStyle.headtitle2,
|
style: AppStyle.headtitle2,
|
||||||
// ),
|
),
|
||||||
// )
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:ride/constant/colors.dart';
|
|||||||
import 'package:ride/constant/style.dart';
|
import 'package:ride/constant/style.dart';
|
||||||
import 'package:ride/controller/home/map_page_controller.dart';
|
import 'package:ride/controller/home/map_page_controller.dart';
|
||||||
import 'package:ride/views/home/map_widget.dart/cancel_raide_page.dart';
|
import 'package:ride/views/home/map_widget.dart/cancel_raide_page.dart';
|
||||||
|
import 'package:ride/views/widgets/circle_container.dart';
|
||||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||||
import 'package:ride/views/widgets/mycircular.dart';
|
import 'package:ride/views/widgets/mycircular.dart';
|
||||||
|
|
||||||
@@ -299,20 +300,31 @@ class CancelRidePageShow extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GetBuilder<MapController>(
|
return GetBuilder<MapController>(
|
||||||
builder: (controller) => controller.data.isNotEmpty
|
builder: (controller) =>
|
||||||
? Positioned(
|
controller.data.isNotEmpty && controller.remainingTime > 0
|
||||||
right: 5,
|
? Positioned.directional(
|
||||||
top: 55,
|
end: 10,
|
||||||
child: GestureDetector(
|
top: 55,
|
||||||
onTap: () {
|
textDirection: TextDirection.ltr,
|
||||||
controller.changeCancelRidePageShow();
|
child: GestureDetector(
|
||||||
},
|
onTap: () {
|
||||||
child: const Icon(
|
controller.changeCancelRidePageShow();
|
||||||
Icons.clear,
|
},
|
||||||
size: 30,
|
child: Container(
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
))
|
color: AppColor.redColor,
|
||||||
: const SizedBox());
|
borderRadius: BorderRadius.circular(15)),
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(3),
|
||||||
|
child: Icon(
|
||||||
|
Icons.clear,
|
||||||
|
size: 30,
|
||||||
|
color: AppColor.secondaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
))
|
||||||
|
: const SizedBox());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,13 +58,20 @@ GetBuilder<MapController> cancelRidePage() {
|
|||||||
itemCount: reasons.length,
|
itemCount: reasons.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(reasons[index]),
|
title: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
controller.selectReason(
|
||||||
|
index,
|
||||||
|
reasons[index].toString(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text(reasons[index])),
|
||||||
leading: Radio(
|
leading: Radio(
|
||||||
value: index,
|
value: index,
|
||||||
groupValue: controller.selectedReason,
|
groupValue: controller.selectedReason,
|
||||||
onChanged: (int? value) {
|
onChanged: (int? value) {
|
||||||
print(value);
|
// print(value);
|
||||||
print(reasons[index]);
|
// print(reasons[index]);
|
||||||
controller.selectReason(
|
controller.selectReason(
|
||||||
value!,
|
value!,
|
||||||
reasons[index].toString(),
|
reasons[index].toString(),
|
||||||
|
|||||||
Reference in New Issue
Block a user