1/15/1
This commit is contained in:
BIN
assets/images/A.png
Normal file
BIN
assets/images/A.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
BIN
assets/images/b.png
Normal file
BIN
assets/images/b.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
@@ -2,6 +2,7 @@ import UIKit
|
|||||||
import Flutter
|
import Flutter
|
||||||
import FirebaseCore
|
import FirebaseCore
|
||||||
import GoogleMaps
|
import GoogleMaps
|
||||||
|
import Constants
|
||||||
|
|
||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
@objc class AppDelegate: FlutterAppDelegate {
|
@objc class AppDelegate: FlutterAppDelegate {
|
||||||
@@ -10,7 +11,7 @@ import GoogleMaps
|
|||||||
_ application: UIApplication,
|
_ application: UIApplication,
|
||||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||||
) -> Bool {
|
) -> Bool {
|
||||||
GMSServices.provideAPIKey("AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0")
|
GMSServices.provideAPIKey(mapsApiKey)
|
||||||
FirebaseApp.configure()
|
FirebaseApp.configure()
|
||||||
GeneratedPluginRegistrant.register(with: self)
|
GeneratedPluginRegistrant.register(with: self)
|
||||||
return true
|
return true
|
||||||
|
|||||||
1
ios/Runner/Constants.swift
Normal file
1
ios/Runner/Constants.swift
Normal file
@@ -0,0 +1 @@
|
|||||||
|
let mapsApiKey = "AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0"
|
||||||
@@ -8,6 +8,7 @@ import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';
|
|||||||
import 'package:location/location.dart';
|
import 'package:location/location.dart';
|
||||||
import 'package:ride/constant/colors.dart';
|
import 'package:ride/constant/colors.dart';
|
||||||
import 'package:ride/constant/style.dart';
|
import 'package:ride/constant/style.dart';
|
||||||
|
import 'package:ride/controller/home/points_for_rider_controller.dart';
|
||||||
import 'package:ride/views/home/map_page_passenger.dart';
|
import 'package:ride/views/home/map_page_passenger.dart';
|
||||||
import 'package:ride/views/home/map_widget.dart/form_serch_multiy_point.dart';
|
import 'package:ride/views/home/map_widget.dart/form_serch_multiy_point.dart';
|
||||||
import '../../constant/api_key.dart';
|
import '../../constant/api_key.dart';
|
||||||
@@ -77,6 +78,8 @@ class MapPassengerController extends GetxController {
|
|||||||
List<LatLng> driverCarsLocationToPassengerAfterApplied = [];
|
List<LatLng> driverCarsLocationToPassengerAfterApplied = [];
|
||||||
BitmapDescriptor markerIcon = BitmapDescriptor.defaultMarker;
|
BitmapDescriptor markerIcon = BitmapDescriptor.defaultMarker;
|
||||||
BitmapDescriptor tripIcon = BitmapDescriptor.defaultMarker;
|
BitmapDescriptor tripIcon = BitmapDescriptor.defaultMarker;
|
||||||
|
BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
|
||||||
|
BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker;
|
||||||
BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
|
BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
|
||||||
double height = 150;
|
double height = 150;
|
||||||
DateTime currentTime = DateTime.now();
|
DateTime currentTime = DateTime.now();
|
||||||
@@ -170,6 +173,7 @@ class MapPassengerController extends GetxController {
|
|||||||
List currentLocationToFormPlacesAll = [];
|
List currentLocationToFormPlacesAll = [];
|
||||||
late String driverToken;
|
late String driverToken;
|
||||||
int carsOrder = 0;
|
int carsOrder = 0;
|
||||||
|
int wayPointIndex = 0;
|
||||||
String? mapAPIKEY;
|
String? mapAPIKEY;
|
||||||
late double totalME = 0;
|
late double totalME = 0;
|
||||||
late double tax = 0;
|
late double tax = 0;
|
||||||
@@ -873,25 +877,22 @@ class MapPassengerController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void changeMainBottomMenuMap() {
|
void changeMainBottomMenuMap() {
|
||||||
print(isWayPointStopsSheetUtilGetMap);
|
// else {
|
||||||
if (isWayPointStopsSheetUtilGetMap == true) {
|
isMainBottomMenuMap = !isMainBottomMenuMap;
|
||||||
isWayPointSheet = true;
|
mainBottomMenuMapHeight =
|
||||||
wayPointSheetHeight = isWayPointSheet == false ? 0 : Get.height * .4;
|
isMainBottomMenuMap == true ? Get.height * .2 : Get.height * .7;
|
||||||
update();
|
isWayPointSheet = false;
|
||||||
} else {
|
if (heightMenuBool == true) {
|
||||||
isMainBottomMenuMap = !isMainBottomMenuMap;
|
getDrawerMenu();
|
||||||
mainBottomMenuMapHeight =
|
|
||||||
isMainBottomMenuMap == true ? Get.height * .2 : Get.height * .7;
|
|
||||||
if (heightMenuBool == true) {
|
|
||||||
getDrawerMenu();
|
|
||||||
}
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeWayPointSheet() {
|
void changeWayPointSheet() {
|
||||||
isWayPointSheet = !isWayPointSheet;
|
isWayPointSheet = !isWayPointSheet;
|
||||||
wayPointSheetHeight = isWayPointSheet == false ? 0 : Get.height * .4;
|
wayPointSheetHeight = isWayPointSheet == false ? 0 : Get.height * .45;
|
||||||
// if (heightMenuBool == true) {
|
// if (heightMenuBool == true) {
|
||||||
// getDrawerMenu();
|
// getDrawerMenu();
|
||||||
// }
|
// }
|
||||||
@@ -899,9 +900,14 @@ class MapPassengerController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void changeWayPointStopsSheet() {
|
void changeWayPointStopsSheet() {
|
||||||
isWayPointStopsSheetUtilGetMap = true;
|
int waypointsLength = Get.find<WayPointController>().wayPoints.length;
|
||||||
|
print('isWayPointStopsSheet $waypointsLength');
|
||||||
|
if (waypointsLength > 2) {
|
||||||
|
isWayPointStopsSheet = true;
|
||||||
|
isWayPointStopsSheetUtilGetMap = true;
|
||||||
|
}
|
||||||
isWayPointStopsSheet = !isWayPointStopsSheet;
|
isWayPointStopsSheet = !isWayPointStopsSheet;
|
||||||
wayPointSheetHeight = isWayPointStopsSheet == false ? 0 : Get.height * .4;
|
wayPointSheetHeight = isWayPointStopsSheet == false ? 0 : Get.height * .45;
|
||||||
// if (heightMenuBool == true) {
|
// if (heightMenuBool == true) {
|
||||||
// getDrawerMenu();
|
// getDrawerMenu();
|
||||||
// }
|
// }
|
||||||
@@ -1082,13 +1088,24 @@ class MapPassengerController extends GetxController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void addCustomTripIcon() {
|
void addCustomStartIcon() {
|
||||||
ImageConfiguration config = ImageConfiguration(
|
ImageConfiguration config = ImageConfiguration(
|
||||||
size: Size(Get.width * .6, Get.height * .6),
|
size: Size(Get.width * .6, Get.height * .6),
|
||||||
);
|
);
|
||||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/brand.png')
|
BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png')
|
||||||
.then((value) {
|
.then((value) {
|
||||||
tripIcon = value;
|
startIcon = value;
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void addCustomEndIcon() {
|
||||||
|
ImageConfiguration config = ImageConfiguration(
|
||||||
|
size: Size(Get.width * .6, Get.height * .6),
|
||||||
|
);
|
||||||
|
BitmapDescriptor.fromAssetImage(config, 'assets/images/b.png')
|
||||||
|
.then((value) {
|
||||||
|
endIcon = value;
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1395,14 +1412,14 @@ class MapPassengerController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int totalStepDurations = 0;
|
int totalStepDurations = 0;
|
||||||
getMapPoints(String origin, destination, int index) async {
|
getMapPoints(String origin, String destination, int index) async {
|
||||||
isWayPointStopsSheetUtilGetMap = false;
|
isWayPointStopsSheetUtilGetMap = false;
|
||||||
await getCarsLocationByPassenger();
|
await getCarsLocationByPassenger();
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
update();
|
update();
|
||||||
var url =
|
var url =
|
||||||
('${AppLink.googleMapsLink}directions/json?&language=en&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}');
|
('${AppLink.googleMapsLink}directions/json?&language=en&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}');
|
||||||
|
print(url);
|
||||||
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
||||||
data = response['routes'][0]['legs'];
|
data = response['routes'][0]['legs'];
|
||||||
// print(data);
|
// print(data);
|
||||||
@@ -1676,7 +1693,8 @@ class MapPassengerController extends GetxController {
|
|||||||
getNearestDriverByPassengerLocation();
|
getNearestDriverByPassengerLocation();
|
||||||
addCustomPicker();
|
addCustomPicker();
|
||||||
addCustomCarIcon();
|
addCustomCarIcon();
|
||||||
addCustomTripIcon();
|
addCustomStartIcon();
|
||||||
|
addCustomEndIcon();
|
||||||
startMarkerReloading();
|
startMarkerReloading();
|
||||||
cardNumber = await SecureStorage().readData(BoxName.cardNumber);
|
cardNumber = await SecureStorage().readData(BoxName.cardNumber);
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ GetBuilder<MapPassengerController> formSearchPlaces(int index) {
|
|||||||
? InkWell(
|
? InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
controller.startLocationFromMapAll[index] = true;
|
controller.startLocationFromMapAll[index] = true;
|
||||||
|
controller.wayPointIndex = index;
|
||||||
|
print(controller.wayPointIndex);
|
||||||
Get.back();
|
Get.back();
|
||||||
// controller.changeMainBottomMenuMap();
|
// controller.changeMainBottomMenuMap();
|
||||||
controller.changeWayPointStopsSheet();
|
controller.changeWayPointStopsSheet();
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
|||||||
markerId: MarkerId('MyLocation'.tr),
|
markerId: MarkerId('MyLocation'.tr),
|
||||||
position: controller.newStartPointLocation,
|
position: controller.newStartPointLocation,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
icon: controller.tripIcon,
|
icon: controller.startIcon,
|
||||||
infoWindow: const InfoWindow(
|
infoWindow: const InfoWindow(
|
||||||
title: 'Time',
|
title: 'Time',
|
||||||
// snippet: controller.durationFromDriverToPassenger
|
// snippet: controller.durationFromDriverToPassenger
|
||||||
@@ -167,12 +167,14 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
|||||||
markerId: MarkerId('Destination'.tr),
|
markerId: MarkerId('Destination'.tr),
|
||||||
position: controller.newMyLocation,
|
position: controller.newMyLocation,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
icon: controller.tripIcon,
|
icon: controller.endIcon,
|
||||||
infoWindow: const InfoWindow(
|
infoWindow: InfoWindow(
|
||||||
title: 'Time',
|
anchor: const Offset(0.5, 0),
|
||||||
// snippet: controller.durationFromDriverToPassenger
|
title: 'Time',
|
||||||
// .toString(),
|
snippet: controller.durationByPassenger.toString()
|
||||||
),
|
// snippet: controller.durationFromDriverToPassenger
|
||||||
|
// .toString(),
|
||||||
|
),
|
||||||
onDragEnd: (value) {
|
onDragEnd: (value) {
|
||||||
print(value);
|
print(value);
|
||||||
},
|
},
|
||||||
@@ -295,6 +297,13 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
|||||||
buildingsEnabled: true,
|
buildingsEnabled: true,
|
||||||
mapToolbarEnabled: true,
|
mapToolbarEnabled: true,
|
||||||
onCameraMove: (position) {
|
onCameraMove: (position) {
|
||||||
|
int waypointsLength =
|
||||||
|
Get.find<WayPointController>().wayPoints.length;
|
||||||
|
int index = controller.wayPointIndex;
|
||||||
|
if (waypointsLength > 0) {
|
||||||
|
controller.placesCoordinate[index] =
|
||||||
|
'${position.target.latitude.toString()},${position.target.longitude}';
|
||||||
|
}
|
||||||
if (controller.startLocationFromMap == true) {
|
if (controller.startLocationFromMap == true) {
|
||||||
controller.newStartPointLocation = position.target;
|
controller.newStartPointLocation = position.target;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user