1/8/1
This commit is contained in:
@@ -9,6 +9,7 @@ import 'package:location/location.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/views/home/map_page_passenger.dart';
|
||||
import 'package:ride/views/home/map_widget.dart/form_serch_multiy_point.dart';
|
||||
import '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/info.dart';
|
||||
@@ -27,18 +28,43 @@ class MapPassengerController extends GetxController {
|
||||
bool isLoading = true;
|
||||
TextEditingController placeDestinationController = TextEditingController();
|
||||
TextEditingController placeStartController = TextEditingController();
|
||||
TextEditingController wayPoint0Controller = TextEditingController();
|
||||
TextEditingController wayPoint1Controller = TextEditingController();
|
||||
TextEditingController wayPoint2Controller = TextEditingController();
|
||||
TextEditingController wayPoint3Controller = TextEditingController();
|
||||
TextEditingController wayPoint4Controller = TextEditingController();
|
||||
TextEditingController sosPhonePassengerProfile = TextEditingController();
|
||||
final sosFormKey = GlobalKey<FormState>();
|
||||
List data = [];
|
||||
List<LatLng> bounds = [];
|
||||
List placesStart = [];
|
||||
List<TextEditingController> allTextEditingPlaces = [];
|
||||
List placesDestination = [];
|
||||
List wayPoint0 = [];
|
||||
List wayPoint1 = [];
|
||||
List wayPoint2 = [];
|
||||
List wayPoint3 = [];
|
||||
List wayPoint4 = [];
|
||||
|
||||
List<List<dynamic>> placeListResponseAll = [];
|
||||
|
||||
List<Widget> placeListResponse = [
|
||||
formSearchPlaces1(),
|
||||
formSearchPlaces2(),
|
||||
formSearchPlaces3(),
|
||||
formSearchPlaces4(),
|
||||
];
|
||||
LatLngBounds? boundsdata;
|
||||
List<Marker> markers = [];
|
||||
List<Polyline> polyLines = [];
|
||||
late LatLng myLocation;
|
||||
late LatLng newMyLocation = const LatLng(32.115295, 36.064773);
|
||||
late LatLng newStartPointLocation = const LatLng(32.115295, 36.064773);
|
||||
late LatLng newPointLocation0 = const LatLng(32.115295, 36.064773);
|
||||
late LatLng newPointLocation1 = const LatLng(32.115295, 36.064773);
|
||||
late LatLng newPointLocation2 = const LatLng(32.115295, 36.064773);
|
||||
late LatLng newPointLocation3 = const LatLng(32.115295, 36.064773);
|
||||
late LatLng newPointLocation4 = const LatLng(32.115295, 36.064773);
|
||||
LatLng myDestination = const LatLng(32.115295, 36.064773);
|
||||
final List<LatLng> polylineCoordinates = [];
|
||||
List<LatLng> carsLocationByPassenger = [];
|
||||
@@ -53,10 +79,17 @@ class MapPassengerController extends GetxController {
|
||||
double heightMenu = 0;
|
||||
double widthMenu = 0;
|
||||
double heightPickerContainer = 90;
|
||||
double heightPointsPageForRider = 0;
|
||||
double mainBottomMenuMap = Get.height * .2;
|
||||
bool startLocationFromMap = false;
|
||||
bool startLocationFromMap0 = false;
|
||||
bool startLocationFromMap1 = false;
|
||||
bool startLocationFromMap2 = false;
|
||||
bool startLocationFromMap3 = false;
|
||||
bool startLocationFromMap4 = false;
|
||||
bool heightMenuBool = false;
|
||||
bool isPickerShown = false;
|
||||
bool isPointsPageForRider = false;
|
||||
bool isBottomSheetShown = false;
|
||||
bool mapType = false;
|
||||
bool mapTrafficON = false;
|
||||
@@ -93,6 +126,11 @@ class MapPassengerController extends GetxController {
|
||||
int remainingTimeTimerRideBegin = 60;
|
||||
String stringRemainingTimeRideBegin = '';
|
||||
String hintTextStartPoint = 'Search for your Start point'.tr;
|
||||
String hintTextwayPoint0 = 'Search for waypoint'.tr;
|
||||
String hintTextwayPoint1 = 'Search for waypoint'.tr;
|
||||
String hintTextwayPoint2 = 'Search for waypoint'.tr;
|
||||
String hintTextwayPoint3 = 'Search for waypoint'.tr;
|
||||
String hintTextwayPoint4 = 'Search for waypoint'.tr;
|
||||
String currentLocationString = 'Current Location'.tr;
|
||||
String hintTextDestinationPoint = 'Search for your destination'.tr;
|
||||
late String rideId;
|
||||
@@ -100,6 +138,11 @@ class MapPassengerController extends GetxController {
|
||||
bool isCashSelectedBeforeConfirmRide = false;
|
||||
bool isPassengerChosen = false;
|
||||
bool currentLocationToFormPlaces = false;
|
||||
bool currentLocationToFormPlaces0 = false;
|
||||
bool currentLocationToFormPlaces1 = false;
|
||||
bool currentLocationToFormPlaces2 = false;
|
||||
bool currentLocationToFormPlaces3 = false;
|
||||
bool currentLocationToFormPlaces4 = false;
|
||||
late String driverToken;
|
||||
int carsOrder = 0;
|
||||
String? mapAPIKEY;
|
||||
@@ -148,6 +191,71 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void convertHintTextPlaces0(int index) {
|
||||
if (wayPoint0.isEmpty) {
|
||||
hintTextwayPoint0 = 'Search for your Start point'.tr;
|
||||
update();
|
||||
} else {
|
||||
hintTextwayPoint0 = wayPoint0[index]['name'];
|
||||
double lat = wayPoint0[index]['geometry']['location']['lat'];
|
||||
double lng = wayPoint0[index]['geometry']['location']['lng'];
|
||||
newPointLocation0 = LatLng(lat, lng);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void convertHintTextPlaces1(int index) {
|
||||
if (wayPoint1.isEmpty) {
|
||||
hintTextwayPoint1 = 'Search for your Start point'.tr;
|
||||
update();
|
||||
} else {
|
||||
hintTextwayPoint1 = wayPoint1[index]['name'];
|
||||
double lat = wayPoint1[index]['geometry']['location']['lat'];
|
||||
double lng = wayPoint1[index]['geometry']['location']['lng'];
|
||||
newPointLocation1 = LatLng(lat, lng);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void convertHintTextPlaces2(int index) {
|
||||
if (wayPoint1.isEmpty) {
|
||||
hintTextwayPoint2 = 'Search for your Start point'.tr;
|
||||
update();
|
||||
} else {
|
||||
hintTextwayPoint2 = wayPoint2[index]['name'];
|
||||
double lat = wayPoint2[index]['geometry']['location']['lat'];
|
||||
double lng = wayPoint2[index]['geometry']['location']['lng'];
|
||||
newPointLocation2 = LatLng(lat, lng);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void convertHintTextPlaces3(int index) {
|
||||
if (wayPoint1.isEmpty) {
|
||||
hintTextwayPoint3 = 'Search for your Start point'.tr;
|
||||
update();
|
||||
} else {
|
||||
hintTextwayPoint3 = wayPoint3[index]['name'];
|
||||
double lat = wayPoint3[index]['geometry']['location']['lat'];
|
||||
double lng = wayPoint3[index]['geometry']['location']['lng'];
|
||||
newPointLocation3 = LatLng(lat, lng);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void convertHintTextPlaces4(int index) {
|
||||
if (wayPoint1.isEmpty) {
|
||||
hintTextwayPoint4 = 'Search for your Start point'.tr;
|
||||
update();
|
||||
} else {
|
||||
hintTextwayPoint4 = wayPoint4[index]['name'];
|
||||
double lat = wayPoint4[index]['geometry']['location']['lat'];
|
||||
double lng = wayPoint4[index]['geometry']['location']['lng'];
|
||||
newPointLocation4 = LatLng(lat, lng);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void convertHintTextDestinationNewPlaces(int index) {
|
||||
if (placesDestination.isEmpty) {
|
||||
hintTextDestinationPoint = 'Search for your destination'.tr;
|
||||
@@ -330,6 +438,36 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
void clearPlaces0() {
|
||||
wayPoint0 = [];
|
||||
hintTextwayPoint0 = 'Search for waypoint'.tr;
|
||||
update();
|
||||
}
|
||||
|
||||
void clearPlaces1() {
|
||||
wayPoint1 = [];
|
||||
hintTextwayPoint1 = 'Search for waypoint'.tr;
|
||||
update();
|
||||
}
|
||||
|
||||
void clearPlaces2() {
|
||||
wayPoint2 = [];
|
||||
hintTextwayPoint2 = 'Search for waypoint'.tr;
|
||||
update();
|
||||
}
|
||||
|
||||
void clearPlaces3() {
|
||||
wayPoint3 = [];
|
||||
hintTextwayPoint3 = 'Search for waypoint'.tr;
|
||||
update();
|
||||
}
|
||||
|
||||
void clearPlaces4() {
|
||||
wayPoint4 = [];
|
||||
hintTextwayPoint4 = 'Search for waypoint'.tr;
|
||||
update();
|
||||
}
|
||||
|
||||
int selectedReason = -1;
|
||||
String? cancelNote;
|
||||
void selectReason(int index, String note) {
|
||||
@@ -684,6 +822,12 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
void changeHeightPointsPageForRider() {
|
||||
isPointsPageForRider = !isPointsPageForRider;
|
||||
heightPointsPageForRider = isPointsPageForRider == true ? Get.height : 0;
|
||||
update();
|
||||
}
|
||||
|
||||
void changeMainBottomMenuMap() {
|
||||
isMainBottomMenuMap = !isMainBottomMenuMap;
|
||||
mainBottomMenuMap =
|
||||
@@ -712,6 +856,51 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
changeHeightPlaces0() {
|
||||
if (wayPoint0.isEmpty) {
|
||||
height = 0;
|
||||
update();
|
||||
}
|
||||
height = 150;
|
||||
update();
|
||||
}
|
||||
|
||||
changeHeightPlaces1() {
|
||||
if (wayPoint1.isEmpty) {
|
||||
height = 0;
|
||||
update();
|
||||
}
|
||||
height = 150;
|
||||
update();
|
||||
}
|
||||
|
||||
changeHeightPlaces2() {
|
||||
if (wayPoint2.isEmpty) {
|
||||
height = 0;
|
||||
update();
|
||||
}
|
||||
height = 150;
|
||||
update();
|
||||
}
|
||||
|
||||
changeHeightPlaces3() {
|
||||
if (wayPoint3.isEmpty) {
|
||||
height = 0;
|
||||
update();
|
||||
}
|
||||
height = 150;
|
||||
update();
|
||||
}
|
||||
|
||||
changeHeightPlaces4() {
|
||||
if (wayPoint4.isEmpty) {
|
||||
height = 0;
|
||||
update();
|
||||
}
|
||||
height = 150;
|
||||
update();
|
||||
}
|
||||
|
||||
hidePlaces() {
|
||||
height = 0;
|
||||
|
||||
@@ -742,6 +931,61 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
Future getPlacesListsWayPoint0() async {
|
||||
var url =
|
||||
'${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${wayPoint0Controller.text}&location=${myLocation.latitude},${myLocation.longitude}&radius=50000&language=en&key=${AK.mapAPIKEY.toString()}';
|
||||
|
||||
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
||||
|
||||
wayPoint0 = response['results'];
|
||||
print(wayPoint0);
|
||||
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) {
|
||||
List<String> parts = location.split(',');
|
||||
double lat = double.parse(parts[0]);
|
||||
@@ -1241,6 +1485,25 @@ class MapPassengerController extends GetxController {
|
||||
addCustomTripIcon();
|
||||
startMarkerReloading();
|
||||
cardNumber = await SecureStorage().readData(BoxName.cardNumber);
|
||||
allTextEditingPlaces = [
|
||||
wayPoint0Controller,
|
||||
wayPoint1Controller,
|
||||
wayPoint2Controller,
|
||||
wayPoint3Controller,
|
||||
wayPoint4Controller,
|
||||
];
|
||||
placeListResponseAll = [
|
||||
wayPoint0,
|
||||
wayPoint1,
|
||||
wayPoint2,
|
||||
wayPoint3,
|
||||
wayPoint4
|
||||
];
|
||||
// placeListResponse.add(wayPoint0);
|
||||
// placeListResponse.add(wayPoint1);
|
||||
// placeListResponse.add(wayPoint2);
|
||||
// placeListResponse.add(wayPoint3);
|
||||
// placeListResponse.add(wayPoint4);
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user