10/6/1
This commit is contained in:
@@ -96,8 +96,11 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
|
|
||||||
Future getToken() async {
|
Future getToken() async {
|
||||||
fcmToken.getToken().then((token) {
|
fcmToken.getToken().then((token) {
|
||||||
box.write(BoxName.tokenFCM, token);
|
if (box.read(BoxName.email) == null) {
|
||||||
box.write(BoxName.tokenDriver, token);
|
box.write(BoxName.tokenDriver, token);
|
||||||
|
} else {
|
||||||
|
box.write(BoxName.tokenFCM, token);
|
||||||
|
}
|
||||||
print(token);
|
print(token);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -184,7 +187,7 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
);
|
);
|
||||||
} else if (message.notification!.title!.contains('Promo')) {
|
} else if (message.notification!.title!.contains('Promo')) {
|
||||||
Get.to(const PromosPassengerPage());
|
Get.to(const PromosPassengerPage());
|
||||||
} else if (message.notification!.title!.contains('BeginTrip')) {
|
} else if (message.notification!.title!.contains('RideIsBegin')) {
|
||||||
// MapDirection mapDirection = Get.find<MapDirection>();
|
// MapDirection mapDirection = Get.find<MapDirection>();
|
||||||
// mapDirection.clearPolyline();
|
// mapDirection.clearPolyline();
|
||||||
print('jjjjjjjjjjjjjjjjjjjjjjjjjjj');
|
print('jjjjjjjjjjjjjjjjjjjjjjjjjjj');
|
||||||
@@ -371,6 +374,15 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
);
|
);
|
||||||
} else if (message.notification!.title!.contains('Promo')) {
|
} else if (message.notification!.title!.contains('Promo')) {
|
||||||
Get.to(const PromosPassengerPage());
|
Get.to(const PromosPassengerPage());
|
||||||
|
} else if (message.notification!.title!.contains('RideIsBegin')) {
|
||||||
|
// MapDirection mapDirection = Get.find<MapDirection>();
|
||||||
|
// mapDirection.clearPolyline();
|
||||||
|
print('jjjjjjjjjjjjjjjjjjjjjjjjjjj');
|
||||||
|
Get.defaultDialog(
|
||||||
|
title: 'The Ride is Begin'.tr,
|
||||||
|
backgroundColor: AppColor.greenColor,
|
||||||
|
);
|
||||||
|
MapDirection().clearPolyline();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -442,7 +454,7 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void sendNotificanToPassengerToken(
|
void sendNotificationToPassengerToken(
|
||||||
String title, body, token, List<String> map) async {
|
String title, body, token, List<String> map) async {
|
||||||
try {
|
try {
|
||||||
final response = await http.post(
|
final response = await http.post(
|
||||||
@@ -479,7 +491,7 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendNotificationToDriverId(
|
void sendNotificationToAnyWithoutData(
|
||||||
String title, String body, String token) async {
|
String title, String body, String token) async {
|
||||||
try {
|
try {
|
||||||
final response = await http.post(
|
final response = await http.post(
|
||||||
@@ -494,7 +506,11 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
'body': body,
|
'body': body,
|
||||||
'sound': 'true'
|
'sound': 'true'
|
||||||
},
|
},
|
||||||
'data': {},
|
'data': <String, dynamic>{
|
||||||
|
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
||||||
|
'id': '1',
|
||||||
|
'status': 'done'
|
||||||
|
},
|
||||||
'priority': 'high',
|
'priority': 'high',
|
||||||
'to': token,
|
'to': token,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -7,3 +7,32 @@ void launchUrl1(String url) async {
|
|||||||
print('Could not launch $url');
|
print('Could not launch $url');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void launchCommunication(
|
||||||
|
String method, String contactInfo, String message) async {
|
||||||
|
String url;
|
||||||
|
|
||||||
|
switch (method) {
|
||||||
|
case 'phone':
|
||||||
|
url = 'tel:$contactInfo';
|
||||||
|
break;
|
||||||
|
case 'sms':
|
||||||
|
url = 'sms:$contactInfo?body=$message';
|
||||||
|
break;
|
||||||
|
case 'whatsapp':
|
||||||
|
url = 'whatsapp://send?phone=$contactInfo&text=$message';
|
||||||
|
break;
|
||||||
|
case 'email':
|
||||||
|
url = 'mailto:$contactInfo?subject=Subject&body=$message';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
print('Invalid communication method');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await canLaunchUrl(Uri.parse(url))) {
|
||||||
|
launchUrl(Uri.parse(url));
|
||||||
|
} else {
|
||||||
|
print('Could not launch $url');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ class LocationController extends GetxController {
|
|||||||
: null)!;
|
: null)!;
|
||||||
|
|
||||||
// Print location details
|
// Print location details
|
||||||
// print('Accuracy: ${_locationData.accuracy}');
|
print('Accuracy: ${_locationData.accuracy}');
|
||||||
// print('Latitude: ${_locationData.latitude}');
|
print('Latitude: ${_locationData.latitude}');
|
||||||
// print('Longitude: ${_locationData.longitude}');
|
print('Longitude: ${_locationData.longitude}');
|
||||||
// print('Time: ${_locationData.time}');
|
print('Time: ${_locationData.time}');
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import 'package:get/get.dart';
|
|||||||
import 'package:ride/constant/box_name.dart';
|
import 'package:ride/constant/box_name.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import '../../../constant/links.dart';
|
||||||
import '../../../main.dart';
|
import '../../../main.dart';
|
||||||
|
import '../../functions/crud.dart';
|
||||||
import '../../functions/location_controller.dart';
|
import '../../functions/location_controller.dart';
|
||||||
|
|
||||||
class HomeCaptainController extends GetxController {
|
class HomeCaptainController extends GetxController {
|
||||||
@@ -50,6 +52,15 @@ class HomeCaptainController extends GetxController {
|
|||||||
return totalDuration;
|
return totalDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() async {
|
||||||
|
await CRUD().post(link: AppLink.addTokensDriver, payload: {
|
||||||
|
'token': box.read(BoxName.tokenDriver),
|
||||||
|
'captain_id': box.read(BoxName.driverID).toString()
|
||||||
|
}).then((value) => print('cccc'));
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
activeTimer?.cancel();
|
activeTimer?.cancel();
|
||||||
|
|||||||
@@ -4,8 +4,11 @@ import 'package:flutter/material.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';
|
||||||
|
import 'package:ride/constant/box_name.dart';
|
||||||
import 'package:ride/constant/colors.dart';
|
import 'package:ride/constant/colors.dart';
|
||||||
|
import 'package:ride/controller/firebase/firbase_messge.dart';
|
||||||
import 'package:ride/controller/functions/location_controller.dart';
|
import 'package:ride/controller/functions/location_controller.dart';
|
||||||
|
import 'package:ride/main.dart';
|
||||||
|
|
||||||
import '../../../constant/credential.dart';
|
import '../../../constant/credential.dart';
|
||||||
import '../../../constant/links.dart';
|
import '../../../constant/links.dart';
|
||||||
@@ -19,6 +22,70 @@ class MapDirection extends GetxController {
|
|||||||
final List<LatLng> polylineCoordinates = [];
|
final List<LatLng> polylineCoordinates = [];
|
||||||
List<Polyline> polyLines = [];
|
List<Polyline> polyLines = [];
|
||||||
Set<Marker> markers = {};
|
Set<Marker> markers = {};
|
||||||
|
late String passengerLocation;
|
||||||
|
late String duration;
|
||||||
|
late String distance;
|
||||||
|
late String name;
|
||||||
|
late String phone;
|
||||||
|
late String rideId;
|
||||||
|
late String tokenPassenger;
|
||||||
|
late String durationToPassenger;
|
||||||
|
late String walletChecked;
|
||||||
|
late String direction;
|
||||||
|
bool isPassengerInfoWindow = false;
|
||||||
|
bool isBtnRideBegin = false;
|
||||||
|
double passengerInfoWindow = Get.height * .32;
|
||||||
|
double progress = 0;
|
||||||
|
double progressToPassenger = 0;
|
||||||
|
bool isRideBegin = false;
|
||||||
|
int progressTimerToShowPassengerInfoWindowFromDriver = 25;
|
||||||
|
int remainingTimeToShowPassengerInfoWindowFromDriver = 25;
|
||||||
|
int remainingTimeToPassenger = 60;
|
||||||
|
bool isDriverNearPassengerStart = false;
|
||||||
|
GoogleMapController? mapController;
|
||||||
|
late LatLng myLocation;
|
||||||
|
|
||||||
|
void onMapCreated(GoogleMapController controller) {
|
||||||
|
LocationController locationController = Get.find<LocationController>();
|
||||||
|
myLocation = locationController.myLocation;
|
||||||
|
mapController = controller;
|
||||||
|
controller.getVisibleRegion();
|
||||||
|
controller.animateCamera(
|
||||||
|
CameraUpdate.newLatLng(myLocation),
|
||||||
|
);
|
||||||
|
update();
|
||||||
|
|
||||||
|
// Set up a timer or interval to trigger the marker update every 3 seconds.
|
||||||
|
Timer.periodic(const Duration(seconds: 3), (_) {
|
||||||
|
updateMarker();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkIsDriverNearPassenger() async {
|
||||||
|
if (isDriverNearPassengerStart) {
|
||||||
|
Timer.periodic(const Duration(seconds: 3), (timer) {
|
||||||
|
String driverLat =
|
||||||
|
Get.find<LocationController>().myLocation.latitude.toString();
|
||||||
|
String driverLng =
|
||||||
|
Get.find<LocationController>().myLocation.longitude.toString();
|
||||||
|
|
||||||
|
// Replace "passengerLat" and "passengerLng" with the actual passenger's location
|
||||||
|
String passengerLat = passengerLocation; // Set the passenger's latitude
|
||||||
|
String passengerLng = ""; // Set the passenger's longitude
|
||||||
|
|
||||||
|
// double distance = calculateDistance(
|
||||||
|
// double.parse(driverLat),
|
||||||
|
// double.parse(driverLng),
|
||||||
|
// double.parse(passengerLat),
|
||||||
|
// double.parse(passengerLng),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (distance < 50) {
|
||||||
|
// print("Distance to passenger: $distance meters");
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void clearPolyline() {
|
void clearPolyline() {
|
||||||
polyLines = [];
|
polyLines = [];
|
||||||
@@ -26,29 +93,87 @@ class MapDirection extends GetxController {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void changeRideToBegin() {
|
||||||
|
isRideBegin = true;
|
||||||
|
passengerInfoWindow = Get.height * .22;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void startTimerToShowPassengerInfoWindowFromDriver() async {
|
||||||
|
for (int i = 0;
|
||||||
|
i <= progressTimerToShowPassengerInfoWindowFromDriver;
|
||||||
|
i++) {
|
||||||
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
|
progress = i / progressTimerToShowPassengerInfoWindowFromDriver;
|
||||||
|
remainingTimeToShowPassengerInfoWindowFromDriver =
|
||||||
|
progressTimerToShowPassengerInfoWindowFromDriver - i;
|
||||||
|
if (remainingTimeToShowPassengerInfoWindowFromDriver == 0) {
|
||||||
|
isPassengerInfoWindow = true;
|
||||||
|
print(isPassengerInfoWindow);
|
||||||
|
update();
|
||||||
|
startTimerToShowDriverToPassengerDuration();
|
||||||
|
}
|
||||||
|
print(isPassengerInfoWindow);
|
||||||
|
print(remainingTimeToShowPassengerInfoWindowFromDriver);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void startTimerToShowDriverToPassengerDuration() async {
|
||||||
|
for (int i = 0; i <= int.parse(durationToPassenger); i++) {
|
||||||
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
|
progressToPassenger = i / int.parse(durationToPassenger);
|
||||||
|
remainingTimeToPassenger = int.parse(durationToPassenger) - i;
|
||||||
|
if (remainingTimeToPassenger == 0) {
|
||||||
|
isBtnRideBegin = true;
|
||||||
|
print(isBtnRideBegin);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
print(isBtnRideBegin);
|
||||||
|
print(remainingTimeToPassenger);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
beginRideFromDriver() async {
|
||||||
|
changeRideToBegin();
|
||||||
|
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||||
|
'id': rideId,
|
||||||
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
|
'status': 'Applied'
|
||||||
|
});
|
||||||
|
FirebaseMessagesController().sendNotificationToAnyWithoutData('RideIsBegin',
|
||||||
|
box.read(BoxName.tokenDriver).toString(), tokenPassenger);
|
||||||
|
}
|
||||||
|
|
||||||
void updateMarker() {
|
void updateMarker() {
|
||||||
// Remove the existing marker with the ID `MyLocation`.
|
// Remove the existing marker with the ID `MyLocation`.
|
||||||
markers.remove(MarkerId('MyLocation'.tr));
|
markers.remove(MarkerId('MyLocation'.tr));
|
||||||
|
|
||||||
// Add a new marker with the ID `MyLocation` at the current location of the user.
|
// Add a new marker with the ID `MyLocation` at the current location of the user.
|
||||||
LocationController locationController = Get.find<LocationController>();
|
LocationController locationController = Get.find<LocationController>();
|
||||||
markers.add(Marker(
|
myLocation = locationController.myLocation;
|
||||||
markerId: MarkerId('MyLocation'.tr),
|
markers.add(
|
||||||
position: locationController.myLocation,
|
Marker(
|
||||||
draggable: true,
|
markerId: MarkerId('MyLocation'.tr),
|
||||||
icon: carIcon,
|
position: locationController.myLocation,
|
||||||
// infoWindow: const InfoWindow(
|
draggable: true,
|
||||||
// title: 'Time',
|
icon: carIcon,
|
||||||
// ),
|
// infoWindow: const InfoWindow(
|
||||||
));
|
// title: 'Time',
|
||||||
|
// ),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
// Update the `markers` set and call the `update()` method on the controller to notify the view that the marker position has changed.
|
// Update the `markers` set and call the `update()` method on the controller to notify the view that the marker position has changed.
|
||||||
update();
|
update();
|
||||||
|
|
||||||
// Reload the marker after 3 seconds.
|
// No recursive call here. The marker update will be triggered externally.
|
||||||
Future.delayed(const Duration(seconds: 3), () {
|
|
||||||
updateMarker();
|
// Optionally, you can animate the camera to the new location after updating the marker.
|
||||||
});
|
mapController!.animateCamera(
|
||||||
|
CameraUpdate.newLatLng(locationController.myLocation),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addCustomCarIcon() {
|
void addCustomCarIcon() {
|
||||||
@@ -106,17 +231,34 @@ class MapDirection extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void changePassengerInfoWindow() {
|
||||||
|
isPassengerInfoWindow = !isPassengerInfoWindow;
|
||||||
|
passengerInfoWindow = isPassengerInfoWindow == true ? 200 : 0;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// Get the passenger location from the arguments.
|
// Get the passenger location from the arguments.
|
||||||
String passengerLocation = Get.arguments['passengerLocation'];
|
passengerLocation = Get.arguments['passengerLocation'];
|
||||||
|
duration = Get.arguments['Duration'];
|
||||||
|
distance = Get.arguments['Distance'];
|
||||||
|
name = Get.arguments['name'];
|
||||||
|
phone = Get.arguments['phone'];
|
||||||
|
walletChecked = Get.arguments['WalletChecked'];
|
||||||
|
tokenPassenger = Get.arguments['tokenPassenger'];
|
||||||
|
direction = Get.arguments['direction'];
|
||||||
|
durationToPassenger = Get.arguments['DurationToPassenger'];
|
||||||
|
rideId = Get.arguments['rideId'];
|
||||||
String lat = Get.find<LocationController>().myLocation.latitude.toString();
|
String lat = Get.find<LocationController>().myLocation.latitude.toString();
|
||||||
String lng = Get.find<LocationController>().myLocation.longitude.toString();
|
String lng = Get.find<LocationController>().myLocation.longitude.toString();
|
||||||
String origin = '$lat,$lng';
|
String origin = '$lat,$lng';
|
||||||
// Set the origin and destination coordinates for the Google Maps directions request.
|
// Set the origin and destination coordinates for the Google Maps directions request.
|
||||||
getMap(origin, passengerLocation);
|
getMap(origin, passengerLocation);
|
||||||
addCustomCarIcon();
|
addCustomCarIcon();
|
||||||
updateMarker();
|
// updateMarker();
|
||||||
|
startTimerToShowPassengerInfoWindowFromDriver();
|
||||||
|
// checkIsDriverNearPassenger();
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,12 +50,12 @@ class MapController extends GetxController {
|
|||||||
bool isCancelRidePageShown = false;
|
bool isCancelRidePageShown = false;
|
||||||
bool isCashConfirmPageShown = false;
|
bool isCashConfirmPageShown = false;
|
||||||
bool isPaymentMethodPageShown = false;
|
bool isPaymentMethodPageShown = false;
|
||||||
bool isPassengerInfoWindow = false;
|
|
||||||
bool rideConfirm = false;
|
bool rideConfirm = false;
|
||||||
bool isMainBottomMenuMap = true;
|
bool isMainBottomMenuMap = true;
|
||||||
double heightBottomSheetShown = 0;
|
double heightBottomSheetShown = 0;
|
||||||
double cashConfirmPageShown = 250;
|
double cashConfirmPageShown = 250;
|
||||||
double passengerInfoWindow = 250;
|
|
||||||
double widthMapTypeAndTraffic = 50;
|
double widthMapTypeAndTraffic = 50;
|
||||||
double paymentPageShown = Get.height * .6;
|
double paymentPageShown = Get.height * .6;
|
||||||
late LatLng southwest;
|
late LatLng southwest;
|
||||||
@@ -92,12 +92,6 @@ class MapController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void changePassengerInfoWindow() {
|
|
||||||
isPassengerInfoWindow = !isPassengerInfoWindow;
|
|
||||||
passengerInfoWindow = isPassengerInfoWindow == true ? 200 : 0;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void changePaymentMethodPageShown() {
|
void changePaymentMethodPageShown() {
|
||||||
isPaymentMethodPageShown = !isPaymentMethodPageShown;
|
isPaymentMethodPageShown = !isPaymentMethodPageShown;
|
||||||
paymentPageShown = isPaymentMethodPageShown == true ? Get.height * .6 : 0;
|
paymentPageShown = isPaymentMethodPageShown == true ? Get.height * .6 : 0;
|
||||||
@@ -203,8 +197,6 @@ class MapController extends GetxController {
|
|||||||
// List<String> body = [
|
// List<String> body = [
|
||||||
rideId = jsonDecode(value)['message'];
|
rideId = jsonDecode(value)['message'];
|
||||||
List<String> body = [
|
List<String> body = [
|
||||||
// '${data[0]['start_address']}',
|
|
||||||
// '${data[0]['end_address']}',
|
|
||||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||||
totalPassenger.toString(),
|
totalPassenger.toString(),
|
||||||
@@ -220,6 +212,8 @@ class MapController extends GetxController {
|
|||||||
distanceByPassenger.toString(),
|
distanceByPassenger.toString(),
|
||||||
paymentController.isWalletChecked.toString(),
|
paymentController.isWalletChecked.toString(),
|
||||||
dataCarsLocationByPassenger['message'][carsOrder]['token'].toString(),
|
dataCarsLocationByPassenger['message'][carsOrder]['token'].toString(),
|
||||||
|
duration1.toString(),
|
||||||
|
rideId,
|
||||||
];
|
];
|
||||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||||
'Order',
|
'Order',
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
|||||||
await Firebase.initializeApp();
|
await Firebase.initializeApp();
|
||||||
print('===========back===${message.notification?.title}');
|
print('===========back===${message.notification?.title}');
|
||||||
|
|
||||||
if (message.notification!.title == 'Sefer') {
|
if (message.notification!.title == 'Sefer') {}
|
||||||
// SendGpsNow().getSiteNotification();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ class MapPage extends StatelessWidget {
|
|||||||
timerForCancelTripFromPassenger(),
|
timerForCancelTripFromPassenger(),
|
||||||
// const DriverTimeArrivePassengerPage(),
|
// const DriverTimeArrivePassengerPage(),
|
||||||
const TimerToPassengerFromDriver(),
|
const TimerToPassengerFromDriver(),
|
||||||
const PassengerInfoWindow()
|
// const PassengerInfoWindow()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ import '../../../controller/home/map_page_controller.dart';
|
|||||||
GetBuilder<MapController> buttomSheetMapPage() {
|
GetBuilder<MapController> buttomSheetMapPage() {
|
||||||
Get.put(PaymentController());
|
Get.put(PaymentController());
|
||||||
return GetBuilder<MapController>(
|
return GetBuilder<MapController>(
|
||||||
builder: (controller) => controller.isBottomSheetShown
|
builder: (controller) => controller.isBottomSheetShown &&
|
||||||
|
controller.rideConfirm == false
|
||||||
? Positioned(
|
? Positioned(
|
||||||
left: 5,
|
left: 5,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
|
|||||||
@@ -1,8 +1,17 @@
|
|||||||
|
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:ride/constant/box_name.dart';
|
||||||
|
import 'package:ride/constant/colors.dart';
|
||||||
|
import 'package:ride/controller/firebase/firbase_messge.dart';
|
||||||
|
import 'package:ride/controller/home/captin/map_dirction.dart';
|
||||||
|
import 'package:ride/main.dart';
|
||||||
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||||
|
|
||||||
|
import '../../../constant/links.dart';
|
||||||
import '../../../constant/style.dart';
|
import '../../../constant/style.dart';
|
||||||
import '../../../controller/home/map_page_controller.dart';
|
import '../../../controller/functions/crud.dart';
|
||||||
|
import '../../../controller/functions/launch.dart';
|
||||||
|
|
||||||
class PassengerInfoWindow extends StatelessWidget {
|
class PassengerInfoWindow extends StatelessWidget {
|
||||||
const PassengerInfoWindow({
|
const PassengerInfoWindow({
|
||||||
@@ -11,18 +20,215 @@ class PassengerInfoWindow extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Get.put(MapController());
|
Get.put(MapDirection());
|
||||||
return GetBuilder<MapController>(
|
return GetBuilder<MapDirection>(
|
||||||
builder: (controller) => controller.isPassengerInfoWindow
|
builder: (controller) => controller.isPassengerInfoWindow == true
|
||||||
? Positioned(
|
? Stack(
|
||||||
bottom: 2,
|
children: [
|
||||||
child: AnimatedContainer(
|
Positioned(
|
||||||
duration: const Duration(milliseconds: 300),
|
bottom: 6,
|
||||||
height: controller.passengerInfoWindow,
|
left: 8,
|
||||||
width: Get.width,
|
child: AnimatedContainer(
|
||||||
decoration: AppStyle.boxDecoration,
|
duration: const Duration(milliseconds: 300),
|
||||||
|
height: controller.passengerInfoWindow,
|
||||||
|
width: Get.width * .8,
|
||||||
|
decoration: AppStyle.boxDecoration,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
DefaultTextStyle(
|
||||||
|
style: AppStyle.title,
|
||||||
|
child: AnimatedTextKit(
|
||||||
|
animatedTexts: [
|
||||||
|
ScaleAnimatedText(
|
||||||
|
'Go to passenger Location now'.tr,
|
||||||
|
),
|
||||||
|
WavyAnimatedText(
|
||||||
|
'Go to passenger Location now'.tr),
|
||||||
|
FlickerAnimatedText(
|
||||||
|
'Go to passenger Location now'.tr),
|
||||||
|
WavyAnimatedText(
|
||||||
|
'Go to passenger Location now'.tr),
|
||||||
|
],
|
||||||
|
isRepeatingAnimation: true,
|
||||||
|
onTap: () {
|
||||||
|
// print("Tap Event");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text('Duration of the Ride is '.tr,
|
||||||
|
style: AppStyle.title),
|
||||||
|
Text(
|
||||||
|
controller.duration.toString() +
|
||||||
|
' ' +
|
||||||
|
'Minute'.tr,
|
||||||
|
style: AppStyle.title),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text('Distance of the Ride is '.tr,
|
||||||
|
style: AppStyle.title),
|
||||||
|
Text(
|
||||||
|
controller.distance.toString() + ' ' + 'KM'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text('Name of the Passenger is '.tr,
|
||||||
|
style: AppStyle.title),
|
||||||
|
Text(
|
||||||
|
controller.name.toString(),
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
controller.isRideBegin
|
||||||
|
? const SizedBox()
|
||||||
|
: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
launchCommunication('phone',
|
||||||
|
controller.phone.toString(), '');
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.phone,
|
||||||
|
color: AppColor.blueColor,
|
||||||
|
)),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
launchCommunication(
|
||||||
|
'whatsapp',
|
||||||
|
controller.phone.toString(),
|
||||||
|
'Hello this is Captain ${box.read(BoxName.nameDriver)}');
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.whatshot,
|
||||||
|
color: AppColor.greenColor,
|
||||||
|
)),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
launchCommunication(
|
||||||
|
'sms',
|
||||||
|
controller.phone.toString(),
|
||||||
|
'Hello this is Captain ${box.read(BoxName.nameDriver)}');
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.sms_rounded,
|
||||||
|
color: AppColor.blueColor,
|
||||||
|
)),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
launchCommunication(
|
||||||
|
'email',
|
||||||
|
controller.phone.toString(),
|
||||||
|
'Hello this is Captain ${box.read(BoxName.nameDriver)}');
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.email,
|
||||||
|
color: AppColor.redColor,
|
||||||
|
)),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () =>
|
||||||
|
FirebaseMessagesController()
|
||||||
|
.sendNotificationToPassengerToken(
|
||||||
|
'Hi',
|
||||||
|
'body',
|
||||||
|
controller.tokenPassenger,
|
||||||
|
[]),
|
||||||
|
icon:
|
||||||
|
const Icon(Icons.notification_add))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
controller.remainingTimeToPassenger != 0
|
||||||
|
? Stack(
|
||||||
|
children: [
|
||||||
|
LinearProgressIndicator(
|
||||||
|
backgroundColor: AppColor.accentColor,
|
||||||
|
color:
|
||||||
|
controller.remainingTimeToPassenger <
|
||||||
|
60
|
||||||
|
? AppColor.redColor
|
||||||
|
: AppColor.greenColor,
|
||||||
|
minHeight: 50,
|
||||||
|
borderRadius: BorderRadius.circular(15),
|
||||||
|
value: controller.progressToPassenger
|
||||||
|
.toDouble(),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Text(
|
||||||
|
controller.remainingTimeToPassenger
|
||||||
|
.toString() +
|
||||||
|
' Seconds'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: controller.isRideBegin
|
||||||
|
? const SizedBox()
|
||||||
|
: MyElevatedButton(
|
||||||
|
title: 'Start the Ride'.tr,
|
||||||
|
onPressed: () {
|
||||||
|
controller.beginRideFromDriver();
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
],
|
||||||
: const SizedBox());
|
)
|
||||||
|
: Positioned(
|
||||||
|
bottom: Get.height * .3,
|
||||||
|
left: 15,
|
||||||
|
child: Container(
|
||||||
|
decoration: AppStyle.boxDecoration,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
const CircularProgressIndicator(
|
||||||
|
backgroundColor: AppColor.redColor,
|
||||||
|
strokeWidth: 10,
|
||||||
|
color: AppColor.redColor,
|
||||||
|
value: 1,
|
||||||
|
),
|
||||||
|
CircularProgressIndicator(
|
||||||
|
value: controller.progress,
|
||||||
|
// Set the color based on the "isNearEnd" condition
|
||||||
|
color: AppColor.yellowColor,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${controller.remainingTimeToShowPassengerInfoWindowFromDriver}',
|
||||||
|
style: AppStyle.number,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Please Wait If passenger want To Cancel!'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,19 +15,36 @@ GetBuilder<MapController> timerForCancelTripFromPassenger() {
|
|||||||
? Positioned(
|
? Positioned(
|
||||||
bottom: Get.height * .35,
|
bottom: Get.height * .35,
|
||||||
left: Get.width * .05,
|
left: Get.width * .05,
|
||||||
child: Stack(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
decoration: AppStyle.boxDecoration,
|
||||||
children: [
|
child: Padding(
|
||||||
CircularProgressIndicator(
|
padding: const EdgeInsets.all(8.0),
|
||||||
value: controller.progress,
|
child: Row(
|
||||||
// Set the color based on the "isNearEnd" condition
|
children: <Widget>[
|
||||||
color: isNearEnd ? Colors.red : Colors.blue,
|
Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
CircularProgressIndicator(
|
||||||
|
value: controller.progress,
|
||||||
|
// Set the color based on the "isNearEnd" condition
|
||||||
|
color: isNearEnd ? Colors.red : Colors.blue,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${controller.remainingTime}',
|
||||||
|
style: AppStyle.number,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 30,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'You can cancel Ride now'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
'${controller.remainingTime}',
|
|
||||||
style: AppStyle.number,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: const SizedBox();
|
: const SizedBox();
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class TimerToPassengerFromDriver extends StatelessWidget {
|
|||||||
controller.driverArrivePassenger();
|
controller.driverArrivePassenger();
|
||||||
// Send notification to driver to alert him that trip is begin
|
// Send notification to driver to alert him that trip is begin
|
||||||
FirebaseMessagesController()
|
FirebaseMessagesController()
|
||||||
.sendNotificationToDriverId(
|
.sendNotificationToAnyWithoutData(
|
||||||
'BeginTrip',
|
'BeginTrip',
|
||||||
box.read(BoxName.name).toString(),
|
box.read(BoxName.name).toString(),
|
||||||
controller.driverToken.toString(),
|
controller.driverToken.toString(),
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: RichText(
|
child: RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text: 'Tatal From Passenger is '.tr,
|
text: 'Total From Passenger is '.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
@@ -116,7 +116,7 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: RichText(
|
child: RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text: 'Tatal For You is '.tr,
|
text: 'Total For You is '.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
@@ -179,7 +179,7 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
];
|
];
|
||||||
// print(bodyToPassenger);
|
// print(bodyToPassenger);
|
||||||
FirebaseMessagesController()
|
FirebaseMessagesController()
|
||||||
.sendNotificanToPassengerToken(
|
.sendNotificationToPassengerToken(
|
||||||
'Apply Ride',
|
'Apply Ride',
|
||||||
arguments['DriverList'][9].toString(),
|
arguments['DriverList'][9].toString(),
|
||||||
arguments['DriverList'][9].toString(),
|
arguments['DriverList'][9].toString(),
|
||||||
@@ -189,6 +189,16 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
Get.back();
|
Get.back();
|
||||||
Get.to(() => PassengerLocationDirection(), arguments: {
|
Get.to(() => PassengerLocationDirection(), arguments: {
|
||||||
'passengerLocation': myList[0].toString(),
|
'passengerLocation': myList[0].toString(),
|
||||||
|
'Duration': myList[4].toString(),
|
||||||
|
'Distance': myList[5].toString(),
|
||||||
|
'name': myList[8].toString(),
|
||||||
|
'phone': myList[10].toString(),
|
||||||
|
'WalletChecked': myList[13].toString(),
|
||||||
|
'tokenPassenger': myList[9].toString(),
|
||||||
|
'direction':
|
||||||
|
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
|
||||||
|
'DurationToPassenger': myList[15].toString(),
|
||||||
|
'rideId': myList[16].toString(),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -225,7 +235,7 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
myList[6].toString(), body.toString());
|
myList[6].toString(), body.toString());
|
||||||
|
|
||||||
FirebaseMessagesController()
|
FirebaseMessagesController()
|
||||||
.sendNotificanToPassengerToken(
|
.sendNotificationToPassengerToken(
|
||||||
'Refused Ride',
|
'Refused Ride',
|
||||||
arguments['DriverList'][9].toString(),
|
arguments['DriverList'][9].toString(),
|
||||||
arguments['DriverList'][9].toString(),
|
arguments['DriverList'][9].toString(),
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import 'package:ride/controller/home/captin/map_dirction.dart';
|
|||||||
import 'package:ride/views/widgets/my_scafold.dart';
|
import 'package:ride/views/widgets/my_scafold.dart';
|
||||||
|
|
||||||
import '../../constant/colors.dart';
|
import '../../constant/colors.dart';
|
||||||
|
import '../../constant/style.dart';
|
||||||
|
import '../../controller/functions/launch.dart';
|
||||||
import '../../controller/functions/location_controller.dart';
|
import '../../controller/functions/location_controller.dart';
|
||||||
import '../home/map_widget.dart/passenger_info_window.dart';
|
import '../home/map_widget.dart/passenger_info_window.dart';
|
||||||
import '../home/map_widget.dart/timer_to_passenger_from_driver.dart';
|
import '../home/map_widget.dart/timer_to_passenger_from_driver.dart';
|
||||||
@@ -24,10 +26,18 @@ class PassengerLocationDirection extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: GetBuilder<MapDirection>(
|
child: GetBuilder<MapDirection>(
|
||||||
builder: (controller) => GoogleMap(
|
builder: (controller) => GoogleMap(
|
||||||
|
onMapCreated: controller.onMapCreated,
|
||||||
initialCameraPosition: CameraPosition(
|
initialCameraPosition: CameraPosition(
|
||||||
target: locationController.myLocation,
|
target: locationController.myLocation,
|
||||||
zoom: 15,
|
zoom: 15,
|
||||||
),
|
),
|
||||||
|
// onCameraMove: (position) {
|
||||||
|
// locationController.myLocation = position.target;
|
||||||
|
// print(position);
|
||||||
|
// },
|
||||||
|
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
|
||||||
|
buildingsEnabled: true,
|
||||||
|
mapToolbarEnabled: true,
|
||||||
polylines: {
|
polylines: {
|
||||||
Polyline(
|
Polyline(
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
@@ -55,14 +65,10 @@ class PassengerLocationDirection extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
onCameraMove: (cameraPosition) {
|
|
||||||
controller.updateMarker();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// const TimerToPassengerFromDriver(),
|
const PassengerInfoWindow(),
|
||||||
const PassengerInfoWindow()
|
|
||||||
],
|
],
|
||||||
isleading: true);
|
isleading: true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user