1/23/1
This commit is contained in:
@@ -2,8 +2,10 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
@@ -11,6 +13,7 @@ import '../../constant/colors.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../main.dart';
|
||||
import '../../views/home/Captin/home_captain/home_captin.dart';
|
||||
import '../../views/home/profile/promos_passenger_page.dart';
|
||||
import '../../views/home/Captin/orderCaptin/order_request_page.dart';
|
||||
|
||||
@@ -160,6 +163,15 @@ class FirebaseMessagesController extends GetxController {
|
||||
);
|
||||
} else if (message.notification!.title!.contains('Promo')) {
|
||||
Get.to(const PromosPassengerPage());
|
||||
} else if (message.notification!.title == 'Cancel Trip') {
|
||||
Get.defaultDialog(
|
||||
title: 'Passenger Cancel Trip'.tr,
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () {
|
||||
Get.offAll(HomeCaptain());
|
||||
}));
|
||||
} else if (message.notification!.title!
|
||||
.contains('DriverIsGoingToPassenger')) {
|
||||
Get.snackbar('Driver is Going To Passenger', '',
|
||||
@@ -201,7 +213,9 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
'sound': 'assets/notify.mp3'
|
||||
'sound': Platform.isAndroid
|
||||
? 'android/app/src/main/res/raw/tone1.mp3'
|
||||
: 'tone2.wav'
|
||||
},
|
||||
'priority': 'high',
|
||||
'data': <String, dynamic>{
|
||||
@@ -259,7 +273,9 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
'sound': 'assets/notify.mp3'
|
||||
'sound': Platform.isAndroid
|
||||
? 'android/app/src/main/res/raw/tone1.mp3'
|
||||
: 'tone2.wav'
|
||||
},
|
||||
'data': {
|
||||
'passengerList': map,
|
||||
@@ -296,7 +312,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
'sound': 'assets/notify.mp3'
|
||||
'sound': Platform.isAndroid ? 'tone2' : 'tone2.wav'
|
||||
},
|
||||
'data': <String, dynamic>{
|
||||
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
||||
@@ -335,7 +351,10 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
'sound': 'assets/notify.mp3'
|
||||
// 'sound': 'tone2.wav',
|
||||
'sound': Platform.isAndroid
|
||||
? 'android/app/src/main/res/raw/tone1.mp3'
|
||||
: 'tone2.wav'
|
||||
},
|
||||
'data': {
|
||||
'DriverList': data,
|
||||
|
||||
@@ -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