1/23/1
This commit is contained in:
@@ -6,6 +6,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/api_key.dart';
|
||||
import '../../../constant/box_name.dart';
|
||||
@@ -72,6 +74,7 @@ class MapDriverController extends GetxController {
|
||||
late Timer timer;
|
||||
String? mapAPIKEY;
|
||||
final zones = <Zone>[];
|
||||
String canelString = 'yet';
|
||||
|
||||
void onMapCreated(GoogleMapController controller) async {
|
||||
myLocation = Get.find<LocationController>().location as LatLng;
|
||||
@@ -257,7 +260,6 @@ class MapDriverController extends GetxController {
|
||||
tokenPassenger);
|
||||
}
|
||||
|
||||
String canelString = '';
|
||||
void cancelCheckRidefromPassenger() async {
|
||||
var res = await CRUD().get(link: AppLink.getOrderCancelStatus, payload: {
|
||||
'order_id': rideId,
|
||||
@@ -265,10 +267,9 @@ class MapDriverController extends GetxController {
|
||||
print('Cancel fetch--------------------');
|
||||
var response = jsonDecode(res);
|
||||
canelString = response['data']['status'];
|
||||
print('cancel is $canelString');
|
||||
update();
|
||||
if (response['data']['status'].toString() == 'Cancel') {
|
||||
Get.snackbar('Order Cancelled'.tr, 'Order Cancelled by Passenger'.tr,
|
||||
backgroundColor: AppColor.redColor);
|
||||
if (canelString == 'Cancel') {
|
||||
remainingTimeTimerRideBegin = 0;
|
||||
remainingTimeToShowPassengerInfoWindowFromDriver = 0;
|
||||
remainingTimeToPassenger = 0;
|
||||
@@ -277,6 +278,18 @@ class MapDriverController extends GetxController {
|
||||
isPassengerInfoWindow = false;
|
||||
clearPolyline();
|
||||
update();
|
||||
Get.defaultDialog(
|
||||
title: 'Order Cancelled'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
middleText: 'Order Cancelled by Passenger'.tr,
|
||||
middleTextStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () {
|
||||
Get.offAll(HomeCaptain());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,7 @@ class MapPassengerController extends GetxController {
|
||||
bool isPaymentMethodPageShown = false;
|
||||
bool isRideFinished = false;
|
||||
bool rideConfirm = false;
|
||||
bool isMarkersShown = false;
|
||||
bool isMainBottomMenuMap = true;
|
||||
bool isWayPointSheet = false;
|
||||
bool isWayPointStopsSheet = false;
|
||||
@@ -869,6 +870,13 @@ class MapPassengerController extends GetxController {
|
||||
// clearPolylineAll();
|
||||
data = [];
|
||||
changeCancelRidePageShow();
|
||||
if (rideId != '') {
|
||||
await CRUD().post(link: AppLink.updateDriverOrder, payload: {
|
||||
"order_id": rideId.toString(), // Convert to String
|
||||
"status": 'Cancel'
|
||||
});
|
||||
}
|
||||
|
||||
rideConfirm = false;
|
||||
shouldFetch = false;
|
||||
isCashConfirmPageShown = false;
|
||||
@@ -886,6 +894,8 @@ class MapPassengerController extends GetxController {
|
||||
"order_id": rideId.toString(), // Convert to String
|
||||
"status": 'Cancel'
|
||||
});
|
||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||
'Cancel Trip', 'Trip Cancelled'.tr, driverToken, []);
|
||||
isPickerShown = false;
|
||||
rideConfirm = false;
|
||||
shouldFetch = false;
|
||||
@@ -1079,27 +1089,17 @@ class MapPassengerController extends GetxController {
|
||||
polylineCoordinatesPointsAll[2].clear();
|
||||
polylineCoordinatesPointsAll[3].clear();
|
||||
polylineCoordinatesPointsAll[4].clear();
|
||||
isMarkersShown = false;
|
||||
update();
|
||||
}
|
||||
|
||||
// void clearPolylineAll() {
|
||||
// polylineCoordinatesPointsAll[0].clear();
|
||||
// polylineCoordinatesPointsAll[1].clear();
|
||||
// polylineCoordinatesPointsAll[2].clear();
|
||||
// polylineCoordinatesPointsAll[3].clear();
|
||||
// polylineCoordinatesPointsAll[4].clear();
|
||||
|
||||
// polyLines = [];
|
||||
// polylineCoordinates.clear();
|
||||
// update();
|
||||
// }
|
||||
|
||||
void addCustomPicker() {
|
||||
ImageConfiguration config = const ImageConfiguration(
|
||||
size: Size(20, 20),
|
||||
// scale: 1.0,
|
||||
);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/picker.png')
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio
|
||||
// scale: 1.0,
|
||||
);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/picker.png',
|
||||
mipmaps: false)
|
||||
.then((value) {
|
||||
markerIcon = value;
|
||||
update();
|
||||
@@ -1109,9 +1109,8 @@ class MapPassengerController extends GetxController {
|
||||
void addCustomStartIcon() async {
|
||||
// Create the marker with the resized image
|
||||
|
||||
ImageConfiguration config = const ImageConfiguration(
|
||||
size: Size(20, 20),
|
||||
);
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png',
|
||||
mipmaps: false)
|
||||
.then((value) {
|
||||
@@ -1122,9 +1121,9 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
void addCustomEndIcon() {
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: Size(Get.width * .6, Get.height * .6),
|
||||
);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/b.png')
|
||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/b.png',
|
||||
mipmaps: false)
|
||||
.then((value) {
|
||||
endIcon = value;
|
||||
update();
|
||||
@@ -1132,12 +1131,14 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
|
||||
void addCustomCarIcon() {
|
||||
ImageConfiguration config = const ImageConfiguration(
|
||||
// size: Size(Get.width * .6, Get.height * .6),
|
||||
size: Size(20, 20),
|
||||
// scale: 1.0,
|
||||
);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/car.png')
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
// size: Size(Get.width * .6, Get.height * .6),
|
||||
size: const Size(30, 30),
|
||||
devicePixelRatio: Get.pixelRatio
|
||||
// scale: 1.0,
|
||||
);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/car.png',
|
||||
mipmaps: false)
|
||||
.then((value) {
|
||||
carIcon = value;
|
||||
update();
|
||||
@@ -1428,6 +1429,7 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
polyLines.add(polyline);
|
||||
rideConfirm = false;
|
||||
isMarkersShown = true;
|
||||
update();
|
||||
}
|
||||
}
|
||||
@@ -1501,6 +1503,7 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
polyLines.add(polyline);
|
||||
rideConfirm = false;
|
||||
isMarkersShown = true;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user