This commit is contained in:
Hamza-Ayed
2023-10-16 16:53:27 +03:00
parent 2105de243c
commit 06905be0e9
13 changed files with 339 additions and 191 deletions

View File

@@ -17,10 +17,13 @@ import 'package:ride/views/Rate/rate_captain.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import '../../main.dart';
import '../../models/model/locations.dart';
import '../functions/launch.dart';
class MapPassengerController extends GetxController {
bool isLoading = true;
TextEditingController placeController = TextEditingController();
TextEditingController sosPhonePassengerProfile = TextEditingController();
final sosFormKey = GlobalKey<FormState>();
List data = [];
List<LatLng> bounds = [];
List places = [];
@@ -80,6 +83,9 @@ class MapPassengerController extends GetxController {
double progressTimerRideBegin = 0;
int remainingTimeTimerRideBegin = 60;
String stringRemainingTimeRideBegin = '';
late String rideId;
late String driverToken;
int carsOrder = 0;
void onChangedPassengerCount(int newValue) {
selectedPassengerCount = newValue;
@@ -116,6 +122,32 @@ class MapPassengerController extends GetxController {
update();
}
void sendSMS(String to) async {
// Get the driver's phone number.
String driverPhone =
dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();
// Format the message.
String message =
'Hi! This is ${box.read(BoxName.name)}. I am using Sefer to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} is driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()} with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}. I am currently located at $myLocation. If you need to reach me, please contact the driver directly at $driverPhone.';
// Launch the URL to send the SMS.
launchCommunication('sms', to, message);
}
void sendWhatsapp(String to) async {
// Get the driver's phone number.
String driverPhone =
dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();
// Format the message.
String message =
'Hi! This is ${box.read(BoxName.name)}. I am using Sefer to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} is driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()} with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}. I am currently located at $myLocation. If you need to reach me, please contact the driver directly at $driverPhone.';
// Launch the URL to send the SMS.
launchCommunication('whatsapp', to, message);
}
void changeCancelRidePageShow() {
// rideConfirm == true
// ?
@@ -223,9 +255,6 @@ class MapPassengerController extends GetxController {
update();
}
late String rideId;
late String driverToken;
int carsOrder = 0;
changeConfirmRide() async {
PaymentController paymentController = Get.find<PaymentController>();
rideConfirm = true;