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 FirebaseCore
|
||||
import GoogleMaps
|
||||
import Constants
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
@@ -10,7 +11,7 @@ import GoogleMaps
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GMSServices.provideAPIKey("AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0")
|
||||
GMSServices.provideAPIKey(mapsApiKey)
|
||||
FirebaseApp.configure()
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
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:ride/constant/colors.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_widget.dart/form_serch_multiy_point.dart';
|
||||
import '../../constant/api_key.dart';
|
||||
@@ -77,6 +78,8 @@ class MapPassengerController extends GetxController {
|
||||
List<LatLng> driverCarsLocationToPassengerAfterApplied = [];
|
||||
BitmapDescriptor markerIcon = BitmapDescriptor.defaultMarker;
|
||||
BitmapDescriptor tripIcon = BitmapDescriptor.defaultMarker;
|
||||
BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
|
||||
BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker;
|
||||
BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
|
||||
double height = 150;
|
||||
DateTime currentTime = DateTime.now();
|
||||
@@ -170,6 +173,7 @@ class MapPassengerController extends GetxController {
|
||||
List currentLocationToFormPlacesAll = [];
|
||||
late String driverToken;
|
||||
int carsOrder = 0;
|
||||
int wayPointIndex = 0;
|
||||
String? mapAPIKEY;
|
||||
late double totalME = 0;
|
||||
late double tax = 0;
|
||||
@@ -873,25 +877,22 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
|
||||
void changeMainBottomMenuMap() {
|
||||
print(isWayPointStopsSheetUtilGetMap);
|
||||
if (isWayPointStopsSheetUtilGetMap == true) {
|
||||
isWayPointSheet = true;
|
||||
wayPointSheetHeight = isWayPointSheet == false ? 0 : Get.height * .4;
|
||||
update();
|
||||
} else {
|
||||
isMainBottomMenuMap = !isMainBottomMenuMap;
|
||||
mainBottomMenuMapHeight =
|
||||
isMainBottomMenuMap == true ? Get.height * .2 : Get.height * .7;
|
||||
if (heightMenuBool == true) {
|
||||
getDrawerMenu();
|
||||
}
|
||||
update();
|
||||
// else {
|
||||
isMainBottomMenuMap = !isMainBottomMenuMap;
|
||||
mainBottomMenuMapHeight =
|
||||
isMainBottomMenuMap == true ? Get.height * .2 : Get.height * .7;
|
||||
isWayPointSheet = false;
|
||||
if (heightMenuBool == true) {
|
||||
getDrawerMenu();
|
||||
}
|
||||
|
||||
update();
|
||||
// }
|
||||
}
|
||||
|
||||
void changeWayPointSheet() {
|
||||
isWayPointSheet = !isWayPointSheet;
|
||||
wayPointSheetHeight = isWayPointSheet == false ? 0 : Get.height * .4;
|
||||
wayPointSheetHeight = isWayPointSheet == false ? 0 : Get.height * .45;
|
||||
// if (heightMenuBool == true) {
|
||||
// getDrawerMenu();
|
||||
// }
|
||||
@@ -899,9 +900,14 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
|
||||
void changeWayPointStopsSheet() {
|
||||
isWayPointStopsSheetUtilGetMap = true;
|
||||
int waypointsLength = Get.find<WayPointController>().wayPoints.length;
|
||||
print('isWayPointStopsSheet $waypointsLength');
|
||||
if (waypointsLength > 2) {
|
||||
isWayPointStopsSheet = true;
|
||||
isWayPointStopsSheetUtilGetMap = true;
|
||||
}
|
||||
isWayPointStopsSheet = !isWayPointStopsSheet;
|
||||
wayPointSheetHeight = isWayPointStopsSheet == false ? 0 : Get.height * .4;
|
||||
wayPointSheetHeight = isWayPointStopsSheet == false ? 0 : Get.height * .45;
|
||||
// if (heightMenuBool == true) {
|
||||
// getDrawerMenu();
|
||||
// }
|
||||
@@ -1082,13 +1088,24 @@ class MapPassengerController extends GetxController {
|
||||
});
|
||||
}
|
||||
|
||||
void addCustomTripIcon() {
|
||||
void addCustomStartIcon() {
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: Size(Get.width * .6, Get.height * .6),
|
||||
);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/brand.png')
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png')
|
||||
.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();
|
||||
});
|
||||
}
|
||||
@@ -1395,14 +1412,14 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
|
||||
int totalStepDurations = 0;
|
||||
getMapPoints(String origin, destination, int index) async {
|
||||
getMapPoints(String origin, String destination, int index) async {
|
||||
isWayPointStopsSheetUtilGetMap = false;
|
||||
await getCarsLocationByPassenger();
|
||||
isLoading = false;
|
||||
update();
|
||||
var url =
|
||||
('${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: {});
|
||||
data = response['routes'][0]['legs'];
|
||||
// print(data);
|
||||
@@ -1676,7 +1693,8 @@ class MapPassengerController extends GetxController {
|
||||
getNearestDriverByPassengerLocation();
|
||||
addCustomPicker();
|
||||
addCustomCarIcon();
|
||||
addCustomTripIcon();
|
||||
addCustomStartIcon();
|
||||
addCustomEndIcon();
|
||||
startMarkerReloading();
|
||||
cardNumber = await SecureStorage().readData(BoxName.cardNumber);
|
||||
|
||||
|
||||
@@ -58,6 +58,8 @@ GetBuilder<MapPassengerController> formSearchPlaces(int index) {
|
||||
? InkWell(
|
||||
onTap: () {
|
||||
controller.startLocationFromMapAll[index] = true;
|
||||
controller.wayPointIndex = index;
|
||||
print(controller.wayPointIndex);
|
||||
Get.back();
|
||||
// controller.changeMainBottomMenuMap();
|
||||
controller.changeWayPointStopsSheet();
|
||||
|
||||
@@ -152,7 +152,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
markerId: MarkerId('MyLocation'.tr),
|
||||
position: controller.newStartPointLocation,
|
||||
draggable: true,
|
||||
icon: controller.tripIcon,
|
||||
icon: controller.startIcon,
|
||||
infoWindow: const InfoWindow(
|
||||
title: 'Time',
|
||||
// snippet: controller.durationFromDriverToPassenger
|
||||
@@ -167,12 +167,14 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
markerId: MarkerId('Destination'.tr),
|
||||
position: controller.newMyLocation,
|
||||
draggable: true,
|
||||
icon: controller.tripIcon,
|
||||
infoWindow: const InfoWindow(
|
||||
title: 'Time',
|
||||
// snippet: controller.durationFromDriverToPassenger
|
||||
// .toString(),
|
||||
),
|
||||
icon: controller.endIcon,
|
||||
infoWindow: InfoWindow(
|
||||
anchor: const Offset(0.5, 0),
|
||||
title: 'Time',
|
||||
snippet: controller.durationByPassenger.toString()
|
||||
// snippet: controller.durationFromDriverToPassenger
|
||||
// .toString(),
|
||||
),
|
||||
onDragEnd: (value) {
|
||||
print(value);
|
||||
},
|
||||
@@ -295,6 +297,13 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
buildingsEnabled: true,
|
||||
mapToolbarEnabled: true,
|
||||
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) {
|
||||
controller.newStartPointLocation = position.target;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user