1/19/1
This commit is contained in:
@@ -96,6 +96,7 @@ class LocationController extends GetxController {
|
|||||||
: null)!;
|
: null)!;
|
||||||
|
|
||||||
// Print location details
|
// Print location details
|
||||||
|
print('myLocation: ${myLocation}');
|
||||||
print('Accuracy: ${_locationData.accuracy}');
|
print('Accuracy: ${_locationData.accuracy}');
|
||||||
print('Latitude: ${_locationData.latitude}');
|
print('Latitude: ${_locationData.latitude}');
|
||||||
print('Longitude: ${_locationData.longitude}');
|
print('Longitude: ${_locationData.longitude}');
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class HomeCaptainController extends GetxController {
|
|||||||
String totalMoneyInSEFER = '0';
|
String totalMoneyInSEFER = '0';
|
||||||
String totalDurationToday = '0';
|
String totalDurationToday = '0';
|
||||||
Timer? timer;
|
Timer? timer;
|
||||||
|
late LatLng myLocation;
|
||||||
String totalPoints = '0';
|
String totalPoints = '0';
|
||||||
String countRefuse = '0';
|
String countRefuse = '0';
|
||||||
bool mapType = false;
|
bool mapType = false;
|
||||||
@@ -146,7 +147,7 @@ class HomeCaptainController extends GetxController {
|
|||||||
mapHomeCaptaiController = controller;
|
mapHomeCaptaiController = controller;
|
||||||
controller.getVisibleRegion();
|
controller.getVisibleRegion();
|
||||||
controller.animateCamera(
|
controller.animateCamera(
|
||||||
CameraUpdate.newLatLng(locationController.myLocation),
|
CameraUpdate.newLatLng(Get.find<LocationController>().myLocation),
|
||||||
);
|
);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -181,6 +182,8 @@ class HomeCaptainController extends GetxController {
|
|||||||
@override
|
@override
|
||||||
void onInit() async {
|
void onInit() async {
|
||||||
await addToken();
|
await addToken();
|
||||||
|
// await Get.find<LocationController>().getLocation();
|
||||||
|
|
||||||
onButtonSelected();
|
onButtonSelected();
|
||||||
getPaymentToday();
|
getPaymentToday();
|
||||||
getAllPayment();
|
getAllPayment();
|
||||||
@@ -188,6 +191,7 @@ class HomeCaptainController extends GetxController {
|
|||||||
onMapCreated(mapHomeCaptaiController!);
|
onMapCreated(mapHomeCaptaiController!);
|
||||||
getRefusedOrderByCaptain();
|
getRefusedOrderByCaptain();
|
||||||
totalPoints = Get.find<CaptainWalletController>().totalPoints;
|
totalPoints = Get.find<CaptainWalletController>().totalPoints;
|
||||||
|
// LocationController().getLocation();
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,13 +73,13 @@ class MapDriverController extends GetxController {
|
|||||||
String? mapAPIKEY;
|
String? mapAPIKEY;
|
||||||
final zones = <Zone>[];
|
final zones = <Zone>[];
|
||||||
|
|
||||||
void onMapCreated(GoogleMapController controller) {
|
void onMapCreated(GoogleMapController controller) async {
|
||||||
LocationController locationController = Get.find<LocationController>();
|
myLocation = Get.find<LocationController>().location as LatLng;
|
||||||
myLocation = locationController.myLocation;
|
myLocation = myLocation;
|
||||||
mapController = controller;
|
mapController = controller;
|
||||||
controller.getVisibleRegion();
|
controller.getVisibleRegion();
|
||||||
controller.animateCamera(
|
controller.animateCamera(
|
||||||
CameraUpdate.newLatLngZoom(myLocation, 17),
|
CameraUpdate.newLatLng(myLocation),
|
||||||
);
|
);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
@@ -442,6 +442,7 @@ class MapDriverController extends GetxController {
|
|||||||
rideId = Get.arguments['rideId'];
|
rideId = Get.arguments['rideId'];
|
||||||
durationOfRideValue = Get.arguments['durationOfRideValue'];
|
durationOfRideValue = Get.arguments['durationOfRideValue'];
|
||||||
paymentAmount = Get.arguments['paymentAmount'];
|
paymentAmount = Get.arguments['paymentAmount'];
|
||||||
|
paymentMethod = Get.arguments['paymentMethod'];
|
||||||
isHaveSteps = Get.arguments['isHaveSteps'];
|
isHaveSteps = Get.arguments['isHaveSteps'];
|
||||||
step0 = Get.arguments['step0'];
|
step0 = Get.arguments['step0'];
|
||||||
step1 = Get.arguments['step1'];
|
step1 = Get.arguments['step1'];
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:math' show cos;
|
import 'dart:math' show cos;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';
|
import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';
|
||||||
@@ -208,6 +209,29 @@ class MapPassengerController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getMapPointsForAllMethods() async {
|
||||||
|
print(placesCoordinate.toString());
|
||||||
|
clearPolyline();
|
||||||
|
isWayPointStopsSheetUtilGetMap = false;
|
||||||
|
durationToRide = 0;
|
||||||
|
wayPointSheetHeight = 0;
|
||||||
|
for (var i = 0; i < Get.find<WayPointController>().wayPoints.length; i++) {
|
||||||
|
if (placesCoordinate[i + 1].toString() != '') {
|
||||||
|
await getMapPoints(
|
||||||
|
placesCoordinate[i].toString(),
|
||||||
|
placesCoordinate[i + 1].toString(),
|
||||||
|
i,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// isWayPointStopsSheet = false;
|
||||||
|
|
||||||
|
changeWayPointStopsSheet();
|
||||||
|
bottomSheet();
|
||||||
|
showBottomSheet1();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
void convertHintTextStartNewPlaces(int index) {
|
void convertHintTextStartNewPlaces(int index) {
|
||||||
if (placesStart.isEmpty) {
|
if (placesStart.isEmpty) {
|
||||||
hintTextStartPoint = 'Search for your Start point'.tr;
|
hintTextStartPoint = 'Search for your Start point'.tr;
|
||||||
@@ -439,19 +463,27 @@ class MapPassengerController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void getBeginRideFromDriver() async {
|
void getBeginRideFromDriver() async {
|
||||||
var res = await CRUD()
|
try {
|
||||||
.get(link: AppLink.getRideStatusBegin, payload: {'ride_id': rideId});
|
var res = await CRUD()
|
||||||
var decode = jsonDecode(res);
|
.get(link: AppLink.getRideStatusBegin, payload: {'ride_id': rideId});
|
||||||
|
if (res == 'failure') {
|
||||||
|
print(res);
|
||||||
|
}
|
||||||
|
var decode = jsonDecode(res);
|
||||||
|
|
||||||
if (decode['data']['status'] == 'Begin') {
|
if (decode['data']['status'] == 'Begin') {
|
||||||
timeToPassengerFromDriverAfterApplied = 0;
|
timeToPassengerFromDriverAfterApplied = 0;
|
||||||
remainingTime = 0;
|
remainingTime = 0;
|
||||||
remainingTimeToPassengerFromDriverAfterApplied = 0;
|
remainingTimeToPassengerFromDriverAfterApplied = 0;
|
||||||
// isCancelRidePageShown = true;
|
// isCancelRidePageShown = true;
|
||||||
rideIsBeginPassengerTimer();
|
rideIsBeginPassengerTimer();
|
||||||
// print('rideTimerBegin: $rideTimerBegin');
|
// print('rideTimerBegin: $rideTimerBegin');
|
||||||
rideTimerBegin = true;
|
rideTimerBegin = true;
|
||||||
update();
|
update();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('Error: $e');
|
||||||
|
// Handle the error or perform any necessary actions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -645,14 +677,6 @@ class MapPassengerController extends GetxController {
|
|||||||
|
|
||||||
cancelRideAfterRejectFromAll();
|
cancelRideAfterRejectFromAll();
|
||||||
}
|
}
|
||||||
} else if (decod['data'].toString() == 'Cancel') {
|
|
||||||
remainingTime = 0;
|
|
||||||
shouldFetch = false;
|
|
||||||
rideConfirm = false;
|
|
||||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
|
||||||
'Trip Canceled'.tr, '', driverToken, []);
|
|
||||||
|
|
||||||
update();
|
|
||||||
} else {
|
} else {
|
||||||
delayAndFetchRideStatus(
|
delayAndFetchRideStatus(
|
||||||
rideId); // Repeat the delay and fetch operation
|
rideId); // Repeat the delay and fetch operation
|
||||||
@@ -824,7 +848,6 @@ class MapPassengerController extends GetxController {
|
|||||||
"status": 'Cancel'
|
"status": 'Cancel'
|
||||||
});
|
});
|
||||||
rideConfirm = false;
|
rideConfirm = false;
|
||||||
totalStepDurations = 0;
|
|
||||||
shouldFetch = false;
|
shouldFetch = false;
|
||||||
isPassengerChosen = false;
|
isPassengerChosen = false;
|
||||||
isCashConfirmPageShown = false;
|
isCashConfirmPageShown = false;
|
||||||
@@ -853,7 +876,6 @@ class MapPassengerController extends GetxController {
|
|||||||
isCashSelectedBeforeConfirmRide = false;
|
isCashSelectedBeforeConfirmRide = false;
|
||||||
isPickerShown = false;
|
isPickerShown = false;
|
||||||
totalStepDurations = 0;
|
totalStepDurations = 0;
|
||||||
totalStepDurations = 0;
|
|
||||||
timeToPassengerFromDriverAfterApplied = 0;
|
timeToPassengerFromDriverAfterApplied = 0;
|
||||||
update();
|
update();
|
||||||
} else {
|
} else {
|
||||||
@@ -872,9 +894,8 @@ class MapPassengerController extends GetxController {
|
|||||||
isCashSelectedBeforeConfirmRide = false;
|
isCashSelectedBeforeConfirmRide = false;
|
||||||
timeToPassengerFromDriverAfterApplied = 0;
|
timeToPassengerFromDriverAfterApplied = 0;
|
||||||
totalStepDurations = 0;
|
totalStepDurations = 0;
|
||||||
totalStepDurations = 0;
|
|
||||||
changeCancelRidePageShow();
|
changeCancelRidePageShow();
|
||||||
// clearPolylineAll();
|
clearPolyline();
|
||||||
remainingTime = 0;
|
remainingTime = 0;
|
||||||
|
|
||||||
update();
|
update();
|
||||||
@@ -922,9 +943,10 @@ class MapPassengerController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void changeWayPointStopsSheet() {
|
void changeWayPointStopsSheet() {
|
||||||
int waypointsLength = Get.find<WayPointController>().wayPoints.length;
|
// int waypointsLength = Get.find<WayPointController>().wayPoints.length;
|
||||||
print('isWayPointStopsSheet $waypointsLength');
|
|
||||||
if (waypointsLength > 2) {
|
print('isWayPointStopsSheet $wayPointIndex');
|
||||||
|
if (wayPointIndex > 1) {
|
||||||
isWayPointStopsSheet = true;
|
isWayPointStopsSheet = true;
|
||||||
isWayPointStopsSheetUtilGetMap = true;
|
isWayPointStopsSheetUtilGetMap = true;
|
||||||
}
|
}
|
||||||
@@ -1041,50 +1063,6 @@ class MapPassengerController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future getPlacesListsWayPoint1() async {
|
|
||||||
// var url =
|
|
||||||
// '${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${wayPoint1Controller.text}&location=${myLocation.latitude},${myLocation.longitude}&radius=50000&language=en&key=${AK.mapAPIKEY.toString()}';
|
|
||||||
|
|
||||||
// var response = await CRUD().getGoogleApi(link: url, payload: {});
|
|
||||||
|
|
||||||
// wayPoint1 = response['results'];
|
|
||||||
// print(wayPoint1);
|
|
||||||
// update();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Future getPlacesListsWayPoint2() async {
|
|
||||||
// var url =
|
|
||||||
// '${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${wayPoint2Controller.text}&location=${myLocation.latitude},${myLocation.longitude}&radius=50000&language=en&key=${AK.mapAPIKEY.toString()}';
|
|
||||||
|
|
||||||
// var response = await CRUD().getGoogleApi(link: url, payload: {});
|
|
||||||
|
|
||||||
// wayPoint2 = response['results'];
|
|
||||||
// print(wayPoint2);
|
|
||||||
// update();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Future getPlacesListsWayPoint3() async {
|
|
||||||
// var url =
|
|
||||||
// '${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${wayPoint3Controller.text}&location=${myLocation.latitude},${myLocation.longitude}&radius=50000&language=en&key=${AK.mapAPIKEY.toString()}';
|
|
||||||
|
|
||||||
// var response = await CRUD().getGoogleApi(link: url, payload: {});
|
|
||||||
|
|
||||||
// wayPoint3 = response['results'];
|
|
||||||
// print(wayPoint3);
|
|
||||||
// update();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Future getPlacesListsWayPoint4() async {
|
|
||||||
// var url =
|
|
||||||
// '${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${wayPoint4Controller.text}&location=${myLocation.latitude},${myLocation.longitude}&radius=50000&language=en&key=${AK.mapAPIKEY.toString()}';
|
|
||||||
|
|
||||||
// var response = await CRUD().getGoogleApi(link: url, payload: {});
|
|
||||||
|
|
||||||
// wayPoint4 = response['results'];
|
|
||||||
// print(wayPoint4);
|
|
||||||
// update();
|
|
||||||
// }
|
|
||||||
|
|
||||||
LatLng fromString(String location) {
|
LatLng fromString(String location) {
|
||||||
List<String> parts = location.split(',');
|
List<String> parts = location.split(',');
|
||||||
double lat = double.parse(parts[0]);
|
double lat = double.parse(parts[0]);
|
||||||
@@ -1128,11 +1106,14 @@ class MapPassengerController extends GetxController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void addCustomStartIcon() {
|
void addCustomStartIcon() async {
|
||||||
ImageConfiguration config = ImageConfiguration(
|
// Create the marker with the resized image
|
||||||
size: Size(Get.width * .6, Get.height * .6),
|
|
||||||
|
ImageConfiguration config = const ImageConfiguration(
|
||||||
|
size: Size(20, 20),
|
||||||
);
|
);
|
||||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png')
|
BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png',
|
||||||
|
mipmaps: false)
|
||||||
.then((value) {
|
.then((value) {
|
||||||
startIcon = value;
|
startIcon = value;
|
||||||
update();
|
update();
|
||||||
|
|||||||
@@ -177,6 +177,11 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
'order_id': body.toString(),
|
'order_id': body.toString(),
|
||||||
'status': 'Apply'
|
'status': 'Apply'
|
||||||
});
|
});
|
||||||
|
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||||
|
'id': myList[16],
|
||||||
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
|
'status': 'Apply'
|
||||||
|
});
|
||||||
// Get.back();
|
// Get.back();
|
||||||
List<String> bodyToPassenger = [
|
List<String> bodyToPassenger = [
|
||||||
box.read(BoxName.driverID).toString(),
|
box.read(BoxName.driverID).toString(),
|
||||||
@@ -184,14 +189,14 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
box.read(BoxName.tokenDriver).toString(),
|
box.read(BoxName.tokenDriver).toString(),
|
||||||
];
|
];
|
||||||
// print(bodyToPassenger);
|
// print(bodyToPassenger);
|
||||||
// FirebaseMessagesController()
|
FirebaseMessagesController()
|
||||||
// .sendNotificationToPassengerToken(
|
.sendNotificationToPassengerToken(
|
||||||
// 'Apply Ride',
|
'Apply Ride',
|
||||||
// arguments['DriverList'][9].toString(),
|
arguments['DriverList'][9].toString(),
|
||||||
// arguments['DriverList'][9].toString(),
|
arguments['DriverList'][9].toString(),
|
||||||
// // box.read(BoxName.tokenDriver).toString(),
|
// box.read(BoxName.tokenDriver).toString(),
|
||||||
// bodyToPassenger,
|
bodyToPassenger,
|
||||||
// );
|
);
|
||||||
Get.back();
|
Get.back();
|
||||||
Get.to(() => PassengerLocationMapPage(), arguments: {
|
Get.to(() => PassengerLocationMapPage(), arguments: {
|
||||||
'passengerLocation': myList[0].toString(),
|
'passengerLocation': myList[0].toString(),
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
|||||||
icon: controller.startIcon,
|
icon: controller.startIcon,
|
||||||
infoWindow: const InfoWindow(
|
infoWindow: const InfoWindow(
|
||||||
title: 'Time',
|
title: 'Time',
|
||||||
|
anchor: Offset(0.5, 0.5), // Adjust the anchor as needed
|
||||||
// snippet: controller.durationFromDriverToPassenger
|
// snippet: controller.durationFromDriverToPassenger
|
||||||
// .toString(),
|
// .toString(),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -51,34 +51,9 @@ class PointsPageForRider extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
wayPointController.wayPoints.length > 1
|
wayPointController.wayPoints.length > 1
|
||||||
? ElevatedButton(
|
? ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
print(mapPassengerController.placesCoordinate
|
mapPassengerController
|
||||||
.toString());
|
.getMapPointsForAllMethods();
|
||||||
controller.clearPolyline();
|
|
||||||
controller.isWayPointStopsSheetUtilGetMap =
|
|
||||||
false;
|
|
||||||
mapPassengerController.durationToRide = 0;
|
|
||||||
for (var i = 0;
|
|
||||||
i < wayPointController.wayPoints.length;
|
|
||||||
i++) {
|
|
||||||
if (mapPassengerController
|
|
||||||
.placesCoordinate[i + 1]
|
|
||||||
.toString() !=
|
|
||||||
'') {
|
|
||||||
mapPassengerController.getMapPoints(
|
|
||||||
mapPassengerController
|
|
||||||
.placesCoordinate[i]
|
|
||||||
.toString(),
|
|
||||||
mapPassengerController
|
|
||||||
.placesCoordinate[i + 1]
|
|
||||||
.toString(),
|
|
||||||
i,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
controller.bottomSheet();
|
|
||||||
controller.showBottomSheet1();
|
|
||||||
},
|
},
|
||||||
child: const Text('Get Map'),
|
child: const Text('Get Map'),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user