2/7/1
This commit is contained in:
@@ -8,6 +8,7 @@ class BoxName {
|
|||||||
static const String agreeTerms = "agreeTerms";
|
static const String agreeTerms = "agreeTerms";
|
||||||
static const String addWork = 'addWork';
|
static const String addWork = 'addWork';
|
||||||
static const String addHome = 'addHome';
|
static const String addHome = 'addHome';
|
||||||
|
static const String tipAmount = 'tipAmount';
|
||||||
static const String accountIdStripeConnect = "accountIdStripeConnect";
|
static const String accountIdStripeConnect = "accountIdStripeConnect";
|
||||||
static const String faceDetectTimes = "faceDetectTimes";
|
static const String faceDetectTimes = "faceDetectTimes";
|
||||||
static const String sosPhonePassenger = "sosPhonePassenger";
|
static const String sosPhonePassenger = "sosPhonePassenger";
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ class AppLink {
|
|||||||
static String getRideOrderID = "$ride/rides/getRideOrderID.php";
|
static String getRideOrderID = "$ride/rides/getRideOrderID.php";
|
||||||
static String getRideStatus = "$ride/rides/getRideStatus.php";
|
static String getRideStatus = "$ride/rides/getRideStatus.php";
|
||||||
static String getRideStatusBegin = "$ride/rides/getRideStatusBegin.php";
|
static String getRideStatusBegin = "$ride/rides/getRideStatusBegin.php";
|
||||||
|
static String getRideStatusFromStartApp =
|
||||||
|
"$ride/rides/getRideStatusFromStartApp.php";
|
||||||
static String updateRides = "$ride/rides/update.php";
|
static String updateRides = "$ride/rides/update.php";
|
||||||
static String deleteRides = "$ride/rides/delete.php";
|
static String deleteRides = "$ride/rides/delete.php";
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:ride/controller/functions/crud.dart';
|
import 'package:ride/controller/functions/crud.dart';
|
||||||
|
import 'package:ride/controller/functions/toast.dart';
|
||||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||||
|
|
||||||
import '../../constant/api_key.dart';
|
import '../../constant/api_key.dart';
|
||||||
@@ -183,33 +184,56 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
// MapPassengerController mapController = Get.put(MapPassengerController());
|
// MapPassengerController mapController = Get.put(MapPassengerController());
|
||||||
Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
|
Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
|
||||||
// mapController.driverArrivePassenger();
|
// mapController.driverArrivePassenger();
|
||||||
|
update();
|
||||||
|
} else if (message.notification!.title!.contains('Hi ,I will go now')) {
|
||||||
|
// MapPassengerController mapController = Get.put(MapPassengerController());
|
||||||
|
Get.snackbar('Hi ,I will go now', '',
|
||||||
|
backgroundColor: AppColor.greenColor);
|
||||||
|
// mapController.driverArrivePassenger();
|
||||||
|
update();
|
||||||
|
} else if (message.notification!.title!
|
||||||
|
.contains('Hi ,I Arrive your site')) {
|
||||||
|
// MapPassengerController mapController = Get.put(MapPassengerController());
|
||||||
|
Get.defaultDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
title: 'Hi ,I Arrive your site'.tr,
|
||||||
|
middleText: 'Please go to Car Driver'.tr,
|
||||||
|
confirm: MyElevatedButton(
|
||||||
|
title: 'Ok I will go now.'.tr,
|
||||||
|
onPressed: () {
|
||||||
|
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||||
|
'Hi ,I will go now'.tr,
|
||||||
|
'I will go now'.tr,
|
||||||
|
Get.find<MapPassengerController>().driverToken, []);
|
||||||
|
Get.back();
|
||||||
|
}));
|
||||||
|
|
||||||
update();
|
update();
|
||||||
} else if (message.notification!.title!.contains('Driver Finish Trip')) {
|
} else if (message.notification!.title!.contains('Driver Finish Trip')) {
|
||||||
var myListString = message.data['passengerList'];
|
var myListString = message.data['passengerList'];
|
||||||
var driverList = jsonDecode(myListString) as List<dynamic>;
|
var driverList = jsonDecode(myListString) as List<dynamic>;
|
||||||
Get.defaultDialog(
|
Get.defaultDialog(
|
||||||
title: 'Driver Finish Trip'.tr,
|
title: 'Driver Finish Trip'.tr,
|
||||||
content: Column(
|
content: DriverTipWidget(),
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'Your fee is ${Get.find<MapPassengerController>().totalPassenger.toStringAsFixed(2)}'),
|
|
||||||
Text('Do you want to pay Tips for this Driver'.tr)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
confirm: MyElevatedButton(
|
confirm: MyElevatedButton(
|
||||||
title: 'Yes'.tr,
|
title: 'Yes'.tr,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
var tip = (Get.find<MapPassengerController>().totalPassenger) *
|
||||||
|
(double.parse(box.read(BoxName.tipAmount.toString())));
|
||||||
var res = await CRUD().post(link: AppLink.addTips, payload: {
|
var res = await CRUD().post(link: AppLink.addTips, payload: {
|
||||||
'passengerID': box.read(BoxName.passengerID),
|
'passengerID': box.read(BoxName.passengerID),
|
||||||
'driverID': driverList[0].toString(),
|
'driverID': driverList[0].toString(),
|
||||||
'rideID': driverList[1].toString(),
|
'rideID': driverList[1].toString(),
|
||||||
'tipAmount': '1',
|
'tipAmount': tip.toString(),
|
||||||
|
});
|
||||||
|
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||||
|
'passenger_id': box.read(BoxName.passengerID).toString(),
|
||||||
|
'balance': ((-1) * tip).toString()
|
||||||
});
|
});
|
||||||
if (res != 'failure') {
|
if (res != 'failure') {
|
||||||
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||||
'You Have Tips',
|
'You Have Tips',
|
||||||
'1\$ tips',
|
'${tip.toString()}\$ tips\nTotal is ${tip + (Get.find<MapPassengerController>().totalPassenger)}',
|
||||||
driverList[2].toString(),
|
driverList[2].toString(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -223,7 +247,8 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
cancel: MyElevatedButton(
|
cancel: MyElevatedButton(
|
||||||
title: 'No,I want'.tr,
|
title: 'No,I want'.tr,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.offAll(() => RateCaptainFromPassenger());
|
Get.back();
|
||||||
|
Get.off(() => RateCaptainFromPassenger());
|
||||||
},
|
},
|
||||||
kolor: AppColor.redColor,
|
kolor: AppColor.redColor,
|
||||||
));
|
));
|
||||||
@@ -411,3 +436,98 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DriverTipWidget extends StatelessWidget {
|
||||||
|
const DriverTipWidget({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Your fee is ${Get.find<MapPassengerController>().totalPassenger.toStringAsFixed(2)}'),
|
||||||
|
Text('Do you want to pay Tips for this Driver'.tr),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
box.write(BoxName.tipAmount, '0.05');
|
||||||
|
Toast.show(
|
||||||
|
context,
|
||||||
|
'Tip is ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipAmount.toString())))}',
|
||||||
|
AppColor.blueColor);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(border: Border.all()),
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(4),
|
||||||
|
child: Center(
|
||||||
|
child: Text('5%'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
box.write(BoxName.tipAmount, '0.10');
|
||||||
|
Toast.show(
|
||||||
|
context,
|
||||||
|
'Tip is ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipAmount.toString())))}',
|
||||||
|
AppColor.blueColor);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(border: Border.all()),
|
||||||
|
child: const Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(5),
|
||||||
|
child: Text('10%'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
box.write(BoxName.tipAmount, '0.15');
|
||||||
|
Toast.show(
|
||||||
|
context,
|
||||||
|
'Tip is ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipAmount.toString())))}',
|
||||||
|
AppColor.blueColor);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(border: Border.all()),
|
||||||
|
child: const Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(5),
|
||||||
|
child: Text('15%'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
box.write(BoxName.tipAmount, '0.20');
|
||||||
|
Toast.show(
|
||||||
|
context,
|
||||||
|
'Tip is ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipAmount.toString())))}',
|
||||||
|
AppColor.blueColor);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(border: Border.all()),
|
||||||
|
child: const Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(5),
|
||||||
|
child: Text('20%'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ class CRUD {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
print(response.request);
|
print(response.request);
|
||||||
//print(payload);
|
print(payload);
|
||||||
|
|
||||||
var jsonData = jsonDecode(response.body);
|
var jsonData = jsonDecode(response.body);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|||||||
@@ -57,18 +57,23 @@ class MapDriverController extends GetxController {
|
|||||||
late String direction;
|
late String direction;
|
||||||
late String durationOfRideValue;
|
late String durationOfRideValue;
|
||||||
late String status;
|
late String status;
|
||||||
|
int timeWaitingPassenger = 5; //5 miniute
|
||||||
bool isPassengerInfoWindow = false;
|
bool isPassengerInfoWindow = false;
|
||||||
bool isBtnRideBegin = false;
|
bool isBtnRideBegin = false;
|
||||||
|
bool isArrivedSend = true;
|
||||||
|
bool isBtnPassengerWait = false;
|
||||||
bool isRideFinished = false;
|
bool isRideFinished = false;
|
||||||
bool isRideStarted = false;
|
bool isRideStarted = false;
|
||||||
double passengerInfoWindow = Get.height * .35;
|
double passengerInfoWindow = Get.height * .35;
|
||||||
double driverEndPage = 100;
|
double driverEndPage = 100;
|
||||||
double progress = 0;
|
double progress = 0;
|
||||||
double progressToPassenger = 0;
|
double progressToPassenger = 0;
|
||||||
|
double progressInPassengerLocationFromDriver = 0;
|
||||||
bool isRideBegin = false;
|
bool isRideBegin = false;
|
||||||
int progressTimerToShowPassengerInfoWindowFromDriver = 25;
|
int progressTimerToShowPassengerInfoWindowFromDriver = 25;
|
||||||
int remainingTimeToShowPassengerInfoWindowFromDriver = 25;
|
int remainingTimeToShowPassengerInfoWindowFromDriver = 25;
|
||||||
int remainingTimeToPassenger = 60;
|
int remainingTimeToPassenger = 60;
|
||||||
|
int remainingTimeInPassengerLocatioWait = 60;
|
||||||
bool isDriverNearPassengerStart = false;
|
bool isDriverNearPassengerStart = false;
|
||||||
GoogleMapController? mapController;
|
GoogleMapController? mapController;
|
||||||
late LatLng myLocation;
|
late LatLng myLocation;
|
||||||
@@ -196,6 +201,31 @@ class MapDriverController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String stringRemainingTimeWaitingPassenger = '';
|
||||||
|
|
||||||
|
void startTimerToShowDriverWaitPassengerDuration() async {
|
||||||
|
for (int i = 0; i <= timeWaitingPassenger * 60; i++) {
|
||||||
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
|
progressInPassengerLocationFromDriver = i / (timeWaitingPassenger * 60);
|
||||||
|
remainingTimeInPassengerLocatioWait = (timeWaitingPassenger * 60) - i;
|
||||||
|
if (remainingTimeInPassengerLocatioWait == 0) {
|
||||||
|
isBtnPassengerWait = true;
|
||||||
|
print(isBtnPassengerWait);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
print(isBtnPassengerWait);
|
||||||
|
print(
|
||||||
|
'remainingTimeInPassengerLocatioWait $remainingTimeInPassengerLocatioWait');
|
||||||
|
|
||||||
|
int minutes = (remainingTimeInPassengerLocatioWait / 60).floor();
|
||||||
|
int seconds = remainingTimeInPassengerLocatioWait % 60;
|
||||||
|
stringRemainingTimeWaitingPassenger =
|
||||||
|
'$minutes:${seconds.toString().padLeft(2, '0')}';
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void driverGoToPassenger() async {
|
void driverGoToPassenger() async {
|
||||||
changeRideToBeginToPassenger();
|
changeRideToBeginToPassenger();
|
||||||
await CRUD().post(link: AppLink.updateRides, payload: {
|
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||||
|
|||||||
@@ -17,9 +17,11 @@ class OrderRequestController extends GetxController {
|
|||||||
String countRefuse = '0';
|
String countRefuse = '0';
|
||||||
bool applied = false;
|
bool applied = false;
|
||||||
final locationController = Get.put(LocationController());
|
final locationController = Get.put(LocationController());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
getRefusedOrderByCaptain();
|
getRefusedOrderByCaptain();
|
||||||
|
|
||||||
update();
|
update();
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,9 +220,11 @@ class MapPassengerController extends GetxController {
|
|||||||
clearPolyline();
|
clearPolyline();
|
||||||
isMarkersShown = false;
|
isMarkersShown = false;
|
||||||
isWayPointStopsSheetUtilGetMap = false;
|
isWayPointStopsSheetUtilGetMap = false;
|
||||||
|
isWayPointSheet = false;
|
||||||
durationToRide = 0;
|
durationToRide = 0;
|
||||||
distanceOfDestnation = 0;
|
distanceOfDestnation = 0;
|
||||||
wayPointSheetHeight = 0;
|
wayPointSheetHeight = 0;
|
||||||
|
remainingTime = 25;
|
||||||
haveSteps = true;
|
haveSteps = true;
|
||||||
|
|
||||||
// Filter out empty value
|
// Filter out empty value
|
||||||
@@ -447,7 +449,7 @@ class MapPassengerController extends GetxController {
|
|||||||
|
|
||||||
String stringRemainingTimeToPassenger = '';
|
String stringRemainingTimeToPassenger = '';
|
||||||
|
|
||||||
void startTimerToPassengerFromDriverAfterApplied() async {
|
void startTimerFromDriverToPassengerAfterApplied() async {
|
||||||
for (int i = 0; i <= timeToPassengerFromDriverAfterApplied; i++) {
|
for (int i = 0; i <= timeToPassengerFromDriverAfterApplied; i++) {
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
progressTimerToPassengerFromDriverAfterApplied =
|
progressTimerToPassengerFromDriverAfterApplied =
|
||||||
@@ -466,6 +468,16 @@ class MapPassengerController extends GetxController {
|
|||||||
int seconds = remainingTimeToPassengerFromDriverAfterApplied % 60;
|
int seconds = remainingTimeToPassengerFromDriverAfterApplied % 60;
|
||||||
stringRemainingTimeToPassenger =
|
stringRemainingTimeToPassenger =
|
||||||
'$minutes:${seconds.toString().padLeft(2, '0')}';
|
'$minutes:${seconds.toString().padLeft(2, '0')}';
|
||||||
|
|
||||||
|
// var cameraUpdate = CameraUpdate.newLatLngZoom(
|
||||||
|
// driverLocationToPassenger,
|
||||||
|
// 17,
|
||||||
|
// );
|
||||||
|
// mapController!.animateCamera(cameraUpdate);
|
||||||
|
|
||||||
|
// print(driverCarsLocationToPassengerAfterApplied);
|
||||||
|
// print(driverCarsLocationToPassengerAfterApplied[0]);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -531,10 +543,38 @@ class MapPassengerController extends GetxController {
|
|||||||
timeToPassengerFromDriverAfterApplied = 0;
|
timeToPassengerFromDriverAfterApplied = 0;
|
||||||
remainingTime = 0;
|
remainingTime = 0;
|
||||||
remainingTimeToPassengerFromDriverAfterApplied = 0;
|
remainingTimeToPassengerFromDriverAfterApplied = 0;
|
||||||
|
rideTimerBegin = true;
|
||||||
|
update();
|
||||||
// isCancelRidePageShown = true;
|
// isCancelRidePageShown = true;
|
||||||
rideIsBeginPassengerTimer();
|
rideIsBeginPassengerTimer();
|
||||||
// //print('rideTimerBegin: $rideTimerBegin');
|
// //print('rideTimerBegin: $rideTimerBegin');
|
||||||
rideTimerBegin = true;
|
}
|
||||||
|
} catch (e) {
|
||||||
|
//print('Error: $e');
|
||||||
|
// Handle the error or perform any necessary actions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void getRideStatusFromStartApp() async {
|
||||||
|
try {
|
||||||
|
var res = await CRUD().get(
|
||||||
|
link: AppLink.getRideStatusFromStartApp,
|
||||||
|
payload: {'passenger_id': box.read(BoxName.passengerID)});
|
||||||
|
if (res == 'failure') {
|
||||||
|
//print(res);
|
||||||
|
}
|
||||||
|
var decode = jsonDecode(res);
|
||||||
|
|
||||||
|
if (decode['data']['status'] == 'Begin') {
|
||||||
|
getMap(
|
||||||
|
decode['data']['start_location'], decode['data']['end_location']);
|
||||||
|
// timeToPassengerFromDriverAfterApplied = 0;
|
||||||
|
// remainingTime = 0;
|
||||||
|
// remainingTimeToPassengerFromDriverAfterApplied = 0;
|
||||||
|
// // isCancelRidePageShown = true;
|
||||||
|
// rideIsBeginPassengerTimer();
|
||||||
|
// // //print('rideTimerBegin: $rideTimerBegin');
|
||||||
|
// rideTimerBegin = true;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -610,6 +650,8 @@ class MapPassengerController extends GetxController {
|
|||||||
late String model;
|
late String model;
|
||||||
late String licensePlate;
|
late String licensePlate;
|
||||||
changeConfirmRide() async {
|
changeConfirmRide() async {
|
||||||
|
await getCarsLocationByPassenger();
|
||||||
|
|
||||||
if (dataCarsLocationByPassenger != 'failure') {
|
if (dataCarsLocationByPassenger != 'failure') {
|
||||||
driverToken =
|
driverToken =
|
||||||
dataCarsLocationByPassenger['message'][carsOrder]['token'].toString();
|
dataCarsLocationByPassenger['message'][carsOrder]['token'].toString();
|
||||||
@@ -633,7 +675,6 @@ class MapPassengerController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
// //print('rideConfirm= $rideConfirm');
|
// //print('rideConfirm= $rideConfirm');
|
||||||
|
|
||||||
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']}',
|
||||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||||
@@ -772,7 +813,7 @@ class MapPassengerController extends GetxController {
|
|||||||
|
|
||||||
// //print('timeToPassengerFromDriverAfterApplied====' +
|
// //print('timeToPassengerFromDriverAfterApplied====' +
|
||||||
// timeToPassengerFromDriverAfterApplied.toString());
|
// timeToPassengerFromDriverAfterApplied.toString());
|
||||||
startTimerToPassengerFromDriverAfterApplied();
|
startTimerFromDriverToPassengerAfterApplied();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
@@ -839,23 +880,25 @@ class MapPassengerController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
late LatLng driverLocationToPassenger = LatLng(32, 35);
|
||||||
Future getDriverCarsLocationToPassengerAfterApplied() async {
|
Future getDriverCarsLocationToPassengerAfterApplied() async {
|
||||||
driverCarsLocationToPassengerAfterApplied = [];
|
driverCarsLocationToPassengerAfterApplied = [];
|
||||||
|
|
||||||
var res = await CRUD().get(
|
var res = await CRUD().get(
|
||||||
link: AppLink.getDriverCarsLocationToPassengerAfterApplied,
|
link: AppLink.getDriverCarsLocationToPassengerAfterApplied,
|
||||||
payload: {
|
payload: {'driver_id': driverId});
|
||||||
'driver_id': dataCarsLocationByPassenger['message'][carsOrder]
|
|
||||||
['driver_id']
|
|
||||||
});
|
|
||||||
|
|
||||||
datadriverCarsLocationToPassengerAfterApplied = jsonDecode(res);
|
datadriverCarsLocationToPassengerAfterApplied = jsonDecode(res);
|
||||||
|
driverLocationToPassenger = LatLng(
|
||||||
|
double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
|
||||||
|
['latitude']),
|
||||||
|
double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
|
||||||
|
['longitude']));
|
||||||
driverCarsLocationToPassengerAfterApplied.add(LatLng(
|
driverCarsLocationToPassengerAfterApplied.add(LatLng(
|
||||||
double.parse(datadriverCarsLocationToPassengerAfterApplied['message']
|
double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
|
||||||
[carsOrder]['latitude']),
|
['latitude']),
|
||||||
double.parse(datadriverCarsLocationToPassengerAfterApplied['message']
|
double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
|
||||||
[carsOrder]['longitude'])));
|
['longitude'])));
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -939,7 +982,7 @@ class MapPassengerController extends GetxController {
|
|||||||
// clearPolylineAll();
|
// clearPolylineAll();
|
||||||
data = [];
|
data = [];
|
||||||
changeCancelRidePageShow();
|
changeCancelRidePageShow();
|
||||||
if (rideId != '') {
|
if (rideId != 'yet') {
|
||||||
await CRUD().post(link: AppLink.updateDriverOrder, payload: {
|
await CRUD().post(link: AppLink.updateDriverOrder, payload: {
|
||||||
"order_id": rideId.toString(), // Convert to String
|
"order_id": rideId.toString(), // Convert to String
|
||||||
"status": 'Cancel'
|
"status": 'Cancel'
|
||||||
@@ -957,6 +1000,7 @@ class MapPassengerController extends GetxController {
|
|||||||
// totalStepDurations = 0;
|
// totalStepDurations = 0;
|
||||||
timeToPassengerFromDriverAfterApplied = 0;
|
timeToPassengerFromDriverAfterApplied = 0;
|
||||||
remainingTime = 0;
|
remainingTime = 0;
|
||||||
|
isWayPointStopsSheetUtilGetMap = false;
|
||||||
update();
|
update();
|
||||||
} else {
|
} else {
|
||||||
clearPlacesDestination();
|
clearPlacesDestination();
|
||||||
@@ -969,6 +1013,7 @@ class MapPassengerController extends GetxController {
|
|||||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||||
'Cancel Trip', 'Trip Cancelled'.tr, driverToken, []);
|
'Cancel Trip', 'Trip Cancelled'.tr, driverToken, []);
|
||||||
isPickerShown = false;
|
isPickerShown = false;
|
||||||
|
isWayPointStopsSheetUtilGetMap = false;
|
||||||
rideConfirm = false;
|
rideConfirm = false;
|
||||||
shouldFetch = false;
|
shouldFetch = false;
|
||||||
isCashConfirmPageShown = false;
|
isCashConfirmPageShown = false;
|
||||||
@@ -1008,7 +1053,7 @@ class MapPassengerController extends GetxController {
|
|||||||
} else {
|
} else {
|
||||||
isMainBottomMenuMap = !isMainBottomMenuMap;
|
isMainBottomMenuMap = !isMainBottomMenuMap;
|
||||||
mainBottomMenuMapHeight =
|
mainBottomMenuMapHeight =
|
||||||
isMainBottomMenuMap == true ? Get.height * .2 : Get.height * .5;
|
isMainBottomMenuMap == true ? Get.height * .2 : Get.height * .6;
|
||||||
isWayPointSheet = false;
|
isWayPointSheet = false;
|
||||||
if (heightMenuBool == true) {
|
if (heightMenuBool == true) {
|
||||||
getDrawerMenu();
|
getDrawerMenu();
|
||||||
@@ -1021,10 +1066,13 @@ class MapPassengerController extends GetxController {
|
|||||||
void downPoints() {
|
void downPoints() {
|
||||||
if (Get.find<WayPointController>().wayPoints.length < 2) {
|
if (Get.find<WayPointController>().wayPoints.length < 2) {
|
||||||
isWayPointStopsSheetUtilGetMap = false;
|
isWayPointStopsSheetUtilGetMap = false;
|
||||||
changeWayPointStopsSheet();
|
isWayPointSheet = false;
|
||||||
|
wayPointSheetHeight = isWayPointStopsSheet ? Get.height * .45 : 0;
|
||||||
|
// changeWayPointStopsSheet();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
changeWayPointStopsSheet();
|
// changeWayPointStopsSheet();
|
||||||
|
// isWayPointSheet = false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1475,6 +1523,7 @@ class MapPassengerController extends GetxController {
|
|||||||
|
|
||||||
late LatLngBounds boundsData;
|
late LatLngBounds boundsData;
|
||||||
getMap(String origin, destination) async {
|
getMap(String origin, destination) async {
|
||||||
|
remainingTime = 25; //to make cancel every call
|
||||||
await getCarsLocationByPassenger();
|
await getCarsLocationByPassenger();
|
||||||
// //print(carsLocationByPassenger);
|
// //print(carsLocationByPassenger);
|
||||||
var coordDestination = destination.split(',');
|
var coordDestination = destination.split(',');
|
||||||
@@ -1694,7 +1743,7 @@ class MapPassengerController extends GetxController {
|
|||||||
print('boundsbounds');
|
print('boundsbounds');
|
||||||
|
|
||||||
// Fit the camera to the bounds
|
// Fit the camera to the bounds
|
||||||
var cameraUpdate = CameraUpdate.newLatLngBounds(bounds, 160);
|
var cameraUpdate = CameraUpdate.newLatLngBounds(bounds, 180);
|
||||||
mapController!.animateCamera(cameraUpdate);
|
mapController!.animateCamera(cameraUpdate);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,9 @@ class CaptainWalletController extends GetxController {
|
|||||||
walletDriverPointsDate = jsonDecode(res);
|
walletDriverPointsDate = jsonDecode(res);
|
||||||
if (walletDriverPointsDate['message'][0]['driverID'].toString() ==
|
if (walletDriverPointsDate['message'][0]['driverID'].toString() ==
|
||||||
box.read(BoxName.driverID)) {
|
box.read(BoxName.driverID)) {
|
||||||
totalPoints =
|
double totalPointsDouble = double.parse(
|
||||||
walletDriverPointsDate['message'][0]['total_amount'].toString();
|
walletDriverPointsDate['message'][0]['total_amount'].toString());
|
||||||
|
totalPoints = totalPointsDouble.toStringAsFixed(0);
|
||||||
} else {
|
} else {
|
||||||
totalPoints = '0';
|
totalPoints = '0';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:animated_text_kit/animated_text_kit.dart';
|
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:ride/constant/box_name.dart';
|
import 'package:ride/constant/box_name.dart';
|
||||||
import 'package:ride/constant/colors.dart';
|
import 'package:ride/constant/colors.dart';
|
||||||
@@ -25,11 +26,11 @@ class PassengerInfoWindow extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 50,
|
bottom: 50,
|
||||||
left: 8,
|
// left: 8,
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
height: controller.passengerInfoWindow,
|
height: controller.passengerInfoWindow,
|
||||||
width: Get.width * .8,
|
width: Get.width * .96,
|
||||||
decoration: AppStyle.boxDecoration,
|
decoration: AppStyle.boxDecoration,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@@ -112,7 +113,7 @@ class PassengerInfoWindow extends StatelessWidget {
|
|||||||
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
|
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
|
||||||
},
|
},
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.whatshot,
|
FontAwesome.whatsapp,
|
||||||
color: AppColor.greenColor,
|
color: AppColor.greenColor,
|
||||||
)),
|
)),
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -137,16 +138,6 @@ class PassengerInfoWindow extends StatelessWidget {
|
|||||||
Icons.email,
|
Icons.email,
|
||||||
color: AppColor.redColor,
|
color: AppColor.redColor,
|
||||||
)),
|
)),
|
||||||
IconButton(
|
|
||||||
onPressed: () =>
|
|
||||||
FirebaseMessagesController()
|
|
||||||
.sendNotificationToPassengerToken(
|
|
||||||
'Hi',
|
|
||||||
'body',
|
|
||||||
controller.tokenPassenger,
|
|
||||||
[]),
|
|
||||||
icon:
|
|
||||||
const Icon(Icons.notification_add))
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
controller.remainingTimeToPassenger != 0
|
controller.remainingTimeToPassenger != 0
|
||||||
@@ -175,12 +166,92 @@ class PassengerInfoWindow extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
: controller.isRideBegin
|
: controller.isRideBegin
|
||||||
? const SizedBox()
|
? const SizedBox()
|
||||||
: MyElevatedButton(
|
: Column(
|
||||||
title: 'Start the Ride'.tr,
|
children: [
|
||||||
kolor: AppColor.greenColor,
|
Row(
|
||||||
onPressed: () {
|
mainAxisAlignment:
|
||||||
controller.startRideFromDriver();
|
MainAxisAlignment.spaceAround,
|
||||||
}),
|
children: [
|
||||||
|
MyElevatedButton(
|
||||||
|
title: 'Start the Ride'.tr,
|
||||||
|
kolor: AppColor.greenColor,
|
||||||
|
onPressed: () {
|
||||||
|
Get.defaultDialog(
|
||||||
|
title:
|
||||||
|
'Is the Passenger in your Car ?'
|
||||||
|
.tr,
|
||||||
|
middleText:
|
||||||
|
'don\'t start trip if not '
|
||||||
|
.tr,
|
||||||
|
confirm: MyElevatedButton(
|
||||||
|
title: 'OK'.tr,
|
||||||
|
onPressed: () {
|
||||||
|
controller
|
||||||
|
.startRideFromDriver();
|
||||||
|
Get.back();
|
||||||
|
}),
|
||||||
|
cancel: MyElevatedButton(
|
||||||
|
title:
|
||||||
|
'No ,still Waiting.'
|
||||||
|
.tr,
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
}));
|
||||||
|
}),
|
||||||
|
controller.isArrivedSend
|
||||||
|
? MyElevatedButton(
|
||||||
|
title: 'I arrive you'.tr,
|
||||||
|
kolor: AppColor.yellowColor,
|
||||||
|
onPressed: () {
|
||||||
|
FirebaseMessagesController()
|
||||||
|
.sendNotificationToPassengerToken(
|
||||||
|
'Hi ,I Arrive your site'
|
||||||
|
.tr,
|
||||||
|
'I Arrive your site'
|
||||||
|
.tr,
|
||||||
|
controller
|
||||||
|
.tokenPassenger,
|
||||||
|
[]);
|
||||||
|
controller
|
||||||
|
.startTimerToShowDriverWaitPassengerDuration();
|
||||||
|
controller.isArrivedSend =
|
||||||
|
false;
|
||||||
|
})
|
||||||
|
: const SizedBox(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
controller.remainingTimeInPassengerLocatioWait <
|
||||||
|
300
|
||||||
|
? Stack(
|
||||||
|
children: [
|
||||||
|
LinearProgressIndicator(
|
||||||
|
backgroundColor:
|
||||||
|
AppColor.accentColor,
|
||||||
|
color: controller
|
||||||
|
.remainingTimeInPassengerLocatioWait <
|
||||||
|
60
|
||||||
|
? AppColor.redColor
|
||||||
|
: AppColor.greenColor,
|
||||||
|
minHeight: 50,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(
|
||||||
|
15),
|
||||||
|
value: controller
|
||||||
|
.progressInPassengerLocationFromDriver
|
||||||
|
.toDouble(),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Text(
|
||||||
|
controller
|
||||||
|
.stringRemainingTimeWaitingPassenger,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
final myListString = arguments['myListString'];
|
final myListString = arguments['myListString'];
|
||||||
final myList = arguments['DriverList'];
|
final myList = arguments['DriverList'];
|
||||||
final body = arguments['body'];
|
final body = arguments['body'];
|
||||||
|
Duration durationToAdd = Duration(seconds: int.parse(myList[4]));
|
||||||
|
int hours = durationToAdd.inHours;
|
||||||
|
int minutes = (durationToAdd.inMinutes % 60).round();
|
||||||
orderRequestController.startTimer(myList[6].toString(), body.toString());
|
orderRequestController.startTimer(myList[6].toString(), body.toString());
|
||||||
return MyScafolld(
|
return MyScafolld(
|
||||||
title: 'Order Request Page'.tr,
|
title: 'Order Request Page'.tr,
|
||||||
@@ -167,8 +170,10 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: myList[4].toString(),
|
text: hours > 1
|
||||||
style: AppStyle.headTitle2),
|
? '${'Your Ride Duration is '.tr}$hours H and $minutes m'
|
||||||
|
: '${'Your Ride Duration is '.tr} $minutes m',
|
||||||
|
style: AppStyle.title),
|
||||||
TextSpan(text: ' Minutes'.tr, style: AppStyle.title),
|
TextSpan(text: ' Minutes'.tr, style: AppStyle.title),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class MainBottomMenuMap extends StatelessWidget {
|
|||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(15),
|
padding: const EdgeInsets.all(15),
|
||||||
@@ -288,6 +289,7 @@ class MainBottomMenuMap extends StatelessWidget {
|
|||||||
controller.currentLocationToFormPlaces =
|
controller.currentLocationToFormPlaces =
|
||||||
false;
|
false;
|
||||||
controller.placesDestination = [];
|
controller.placesDestination = [];
|
||||||
|
// controller.isCancelRidePageShown = true;
|
||||||
controller.clearPlacesStart();
|
controller.clearPlacesStart();
|
||||||
controller.clearPlacesDestination();
|
controller.clearPlacesDestination();
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class PointsPageForRider extends StatelessWidget {
|
|||||||
left: 2,
|
left: 2,
|
||||||
right: 2,
|
right: 2,
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 800),
|
duration: const Duration(milliseconds: 300),
|
||||||
height: controller.wayPointSheetHeight,
|
height: controller.wayPointSheetHeight,
|
||||||
decoration: AppStyle.boxDecoration,
|
decoration: AppStyle.boxDecoration,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import 'package:get/get.dart';
|
|||||||
import 'package:ride/constant/box_name.dart';
|
import 'package:ride/constant/box_name.dart';
|
||||||
import 'package:ride/constant/colors.dart';
|
import 'package:ride/constant/colors.dart';
|
||||||
import 'package:ride/constant/style.dart';
|
import 'package:ride/constant/style.dart';
|
||||||
|
import 'package:ride/controller/home/map_passenger_controller.dart';
|
||||||
import 'package:ride/controller/home/payment/captain_wallet_controller.dart';
|
import 'package:ride/controller/home/payment/captain_wallet_controller.dart';
|
||||||
import 'package:ride/controller/home/payment/credit_card_controller.dart';
|
|
||||||
import 'package:ride/controller/payment/payment_controller.dart';
|
import 'package:ride/controller/payment/payment_controller.dart';
|
||||||
import 'package:ride/main.dart';
|
import 'package:ride/main.dart';
|
||||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||||
@@ -19,6 +19,7 @@ class WaletCaptain extends StatelessWidget {
|
|||||||
Get.put(CaptainWalletController());
|
Get.put(CaptainWalletController());
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Get.put(MapPassengerController());
|
||||||
return MyScafolld(
|
return MyScafolld(
|
||||||
title: 'Captain Wallet'.tr,
|
title: 'Captain Wallet'.tr,
|
||||||
body: [
|
body: [
|
||||||
|
|||||||
Reference in New Issue
Block a user