1/24/1
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
import 'package:ride/views/home/Captin/home_captain/drawer_captain.dart';
|
||||
import 'package:ride/views/widgets/mycircular.dart';
|
||||
|
||||
import '../../../../constant/colors.dart';
|
||||
import '../../../../constant/info.dart';
|
||||
@@ -19,14 +20,14 @@ import '../../../widgets/circle_container.dart';
|
||||
|
||||
class HomeCaptain extends StatelessWidget {
|
||||
HomeCaptain({super.key});
|
||||
final LocationController locationController = LocationController();
|
||||
final LocationController locationController = Get.put(LocationController());
|
||||
// final HomeCaptainController homeCaptainController = HomeCaptainController();
|
||||
// final LocationController locationController=LocationController();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(OrderRequestController());
|
||||
Get.put(HomeCaptainController());
|
||||
// Get.put(HomeCaptainController());
|
||||
Get.put(LocationController());
|
||||
print('local is ${Get.find<LocaleController>().language!.countryCode}');
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -64,28 +65,31 @@ class HomeCaptain extends StatelessWidget {
|
||||
body: Stack(
|
||||
children: [
|
||||
GetBuilder<HomeCaptainController>(
|
||||
builder: (controller) => GoogleMap(
|
||||
onMapCreated: controller.onMapCreated,
|
||||
// cameraTargetBounds: CameraTargetBounds(controller.boundsdata),
|
||||
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
|
||||
builder: (controller) => controller.isLoading
|
||||
? const MyCircularProgressIndicator()
|
||||
: GoogleMap(
|
||||
onMapCreated: controller.onMapCreated,
|
||||
// cameraTargetBounds: CameraTargetBounds(controller.boundsdata),
|
||||
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
|
||||
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: locationController.myLocation,
|
||||
zoom: 15,
|
||||
),
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: locationController.myLocation,
|
||||
zoom: 15,
|
||||
),
|
||||
|
||||
mapType: controller.mapType ? MapType.satellite : MapType.normal,
|
||||
myLocationButtonEnabled: true,
|
||||
// liteModeEnabled: true, tiltGesturesEnabled: false,
|
||||
mapType:
|
||||
controller.mapType ? MapType.satellite : MapType.normal,
|
||||
myLocationButtonEnabled: true,
|
||||
// liteModeEnabled: true, tiltGesturesEnabled: false,
|
||||
|
||||
// indoorViewEnabled: true,
|
||||
trafficEnabled: controller.mapTrafficON,
|
||||
buildingsEnabled: true,
|
||||
mapToolbarEnabled: true,
|
||||
// indoorViewEnabled: true,
|
||||
trafficEnabled: controller.mapTrafficON,
|
||||
buildingsEnabled: true,
|
||||
mapToolbarEnabled: true,
|
||||
|
||||
myLocationEnabled: true,
|
||||
// liteModeEnabled: true,
|
||||
),
|
||||
myLocationEnabled: true,
|
||||
// liteModeEnabled: true,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 10,
|
||||
|
||||
@@ -25,10 +25,10 @@ class GoogleDriverMap extends StatelessWidget {
|
||||
target: locationController.myLocation,
|
||||
zoom: 15,
|
||||
),
|
||||
// onCameraMove: (position) {
|
||||
// locationController.myLocation = position.target;
|
||||
// print(position);
|
||||
// },
|
||||
onCameraMove: (position) {
|
||||
locationController.myLocation = position.target;
|
||||
print(position);
|
||||
},
|
||||
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
|
||||
buildingsEnabled: true,
|
||||
mapToolbarEnabled: true,
|
||||
@@ -40,7 +40,7 @@ class GoogleDriverMap extends StatelessWidget {
|
||||
endCap: Cap.buttCap,
|
||||
startCap: Cap.buttCap,
|
||||
visible: true,
|
||||
polylineId: const PolylineId('route'),
|
||||
polylineId: const PolylineId('route1'),
|
||||
points: controller.polylineCoordinates,
|
||||
color: AppColor.greenColor,
|
||||
width: 5,
|
||||
@@ -64,11 +64,18 @@ class GoogleDriverMap extends StatelessWidget {
|
||||
position: locationController.myLocation,
|
||||
draggable: true,
|
||||
icon: controller.carIcon,
|
||||
infoWindow: const InfoWindow(
|
||||
title: 'Time',
|
||||
// snippet: controller.durationFromDriverToPassenger
|
||||
// .toString(),
|
||||
),
|
||||
),
|
||||
Marker(
|
||||
markerId: MarkerId('start'.tr),
|
||||
position: controller.latLngpassengerLocation,
|
||||
draggable: true,
|
||||
icon: controller.startIcon,
|
||||
),
|
||||
Marker(
|
||||
markerId: MarkerId('end'.tr),
|
||||
position: controller.latLngPassengerDestination,
|
||||
draggable: true,
|
||||
icon: controller.endIcon,
|
||||
),
|
||||
},
|
||||
),
|
||||
|
||||
@@ -82,7 +82,7 @@ GetBuilder<MapPassengerController> formSearchPlaces() {
|
||||
|
||||
controller.changeHeightPlaces();
|
||||
|
||||
controller.myLocation = controller.newMyLocation;
|
||||
controller.passengerLocation = controller.newMyLocation;
|
||||
controller.convertHintTextDestinationNewPlaces(index);
|
||||
|
||||
controller.placesDestination = [];
|
||||
|
||||
@@ -87,9 +87,9 @@ GetBuilder<MapPassengerController> formSearchPlaces(int index) {
|
||||
if (controller.currentLocationToFormPlacesAll[index] ==
|
||||
true) {
|
||||
controller.newStartPointLocation =
|
||||
controller.myLocation;
|
||||
controller.passengerLocation;
|
||||
} else {
|
||||
controller.myLocation =
|
||||
controller.passengerLocation =
|
||||
controller.newStartPointLocation;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
controller.clearPolyline();
|
||||
if (controller.dataCarsLocationByPassenger != null) {
|
||||
await controller.getMap(
|
||||
'${controller.myLocation.latitude},${controller.myLocation.longitude}',
|
||||
'${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
|
||||
'${argument.latitude.toString()},${argument.longitude.toString()}');
|
||||
|
||||
Get.back();
|
||||
@@ -131,7 +131,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
// controller.bottomSheet();
|
||||
},
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: controller.myLocation,
|
||||
target: controller.passengerLocation,
|
||||
zoom: 15,
|
||||
),
|
||||
markers: {
|
||||
@@ -154,43 +154,44 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
position: controller.newStartPointLocation,
|
||||
draggable: true,
|
||||
icon: controller.startIcon,
|
||||
infoWindow: const InfoWindow(
|
||||
title: 'Time',
|
||||
anchor: Offset(0.5, 0.5), // Adjust the anchor as needed
|
||||
// snippet: controller.durationFromDriverToPassenger
|
||||
// .toString(),
|
||||
),
|
||||
onDragEnd: (value) {
|
||||
print(value);
|
||||
},
|
||||
// infoWindow: InfoWindow(title: 'my location'.tr),
|
||||
),
|
||||
if (controller.isMarkersShown)
|
||||
Marker(
|
||||
markerId: MarkerId('Destination'.tr),
|
||||
position: controller.newMyLocation,
|
||||
position: controller.myDestination,
|
||||
draggable: true,
|
||||
icon: controller.endIcon,
|
||||
),
|
||||
if (controller.haveSteps)
|
||||
Marker(
|
||||
markerId: MarkerId('StartSteps'.tr),
|
||||
position: LatLng(
|
||||
double.parse(
|
||||
controller.placesCoordinate[0].split(',')[0]),
|
||||
double.parse(
|
||||
controller.placesCoordinate[0].split(',')[1])),
|
||||
draggable: true,
|
||||
icon: controller.startIcon,
|
||||
),
|
||||
if (controller.haveSteps)
|
||||
Marker(
|
||||
markerId: MarkerId('EndSteps'.tr),
|
||||
position: controller.newPointLocation4 == ''
|
||||
? LatLng(
|
||||
double.parse(
|
||||
controller.placesCoordinate[3].split(',')[0]),
|
||||
double.parse(
|
||||
controller.placesCoordinate[3].split(',')[1]))
|
||||
: controller.newPointLocation3 == ''
|
||||
? LatLng(
|
||||
double.parse(controller.placesCoordinate[2]
|
||||
.split(',')[0]),
|
||||
double.parse(controller.placesCoordinate[2]
|
||||
.split(',')[1]))
|
||||
: controller.newPointLocation2,
|
||||
draggable: true,
|
||||
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);
|
||||
},
|
||||
// infoWindow: InfoWindow(title: 'my location'.tr),
|
||||
),
|
||||
// Marker(
|
||||
// markerId: MarkerId('Target'.tr),
|
||||
// position: controller.myDestination,
|
||||
// draggable: true,
|
||||
// onDragEnd: (v) {
|
||||
// print(v);
|
||||
// },
|
||||
// ),
|
||||
},
|
||||
polylines: {
|
||||
Polyline(
|
||||
@@ -283,7 +284,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
circles: <Circle>{
|
||||
Circle(
|
||||
circleId: const CircleId('circle_id'),
|
||||
center: controller.myLocation,
|
||||
center: controller.passengerLocation,
|
||||
radius: 100,
|
||||
fillColor: Colors.blue.withOpacity(0.3),
|
||||
strokeColor: Colors.blue,
|
||||
|
||||
@@ -348,7 +348,7 @@ class FavioratePlacesDialogu extends StatelessWidget {
|
||||
Get.back();
|
||||
await controller.getLocation();
|
||||
await controller.getMap(
|
||||
'${controller.myLocation.latitude},${controller.myLocation.longitude}',
|
||||
'${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
|
||||
'${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
|
||||
);
|
||||
// controller.changePickerShown();
|
||||
|
||||
@@ -135,7 +135,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
onPressed: () async {
|
||||
await controller
|
||||
.getMap(
|
||||
'${controller.myLocation.latitude},${controller.myLocation.longitude}',
|
||||
'${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
|
||||
'${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
|
||||
);
|
||||
controller
|
||||
@@ -193,7 +193,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
title: 'Go to this Target'.tr,
|
||||
onPressed: () async {
|
||||
await controller.getMap(
|
||||
'${controller.myLocation.latitude},${controller.myLocation.longitude}',
|
||||
'${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
|
||||
'${controller.newMyLocation.latitude},${controller.newMyLocation.longitude}',
|
||||
);
|
||||
controller.changePickerShown();
|
||||
|
||||
Reference in New Issue
Block a user