2-10/3/1
This commit is contained in:
@@ -24,6 +24,7 @@ class HomeCaptainController extends GetxController {
|
||||
Duration activeDuration = Duration.zero;
|
||||
Timer? activeTimer;
|
||||
Map data = {};
|
||||
BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
|
||||
bool isLoading = true;
|
||||
late double kazan = 0;
|
||||
double latePrice = 0;
|
||||
@@ -69,6 +70,19 @@ class HomeCaptainController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
void addCustomCarIcon() {
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: const Size(30, 35), devicePixelRatio: Get.pixelRatio);
|
||||
BitmapDescriptor.asset(
|
||||
config,
|
||||
'assets/images/car.png',
|
||||
// mipmaps: false,
|
||||
).then((value) {
|
||||
carIcon = value;
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
String stringActiveDuration = '';
|
||||
void onButtonSelected() {
|
||||
// totalPoints = Get.find<CaptainWalletController>().totalPoints;
|
||||
@@ -170,15 +184,23 @@ class HomeCaptainController extends GetxController {
|
||||
// CameraUpdate.newLatLng(Get.find<LocationController>().myLocation),
|
||||
// );
|
||||
// }
|
||||
GoogleMapController? mapHomeCaptainController; // Initialize to null
|
||||
GoogleMapController? mapHomeCaptainController; // Nullable controller
|
||||
|
||||
void onMapCreated(GoogleMapController controller) {
|
||||
mapHomeCaptainController = controller;
|
||||
controller.getVisibleRegion();
|
||||
// Animate camera to user location (optional)
|
||||
controller.animateCamera(
|
||||
CameraUpdate.newLatLng(Get.find<LocationController>().myLocation),
|
||||
);
|
||||
|
||||
// Optional: Check if the controller is still null (just for safety)
|
||||
if (mapHomeCaptainController != null) {
|
||||
// Get the visible region
|
||||
controller.getVisibleRegion();
|
||||
|
||||
// Animate camera to user location (optional)
|
||||
controller.animateCamera(
|
||||
CameraUpdate.newLatLng(Get.find<LocationController>().myLocation),
|
||||
);
|
||||
} else {
|
||||
print("Controller is null, cannot proceed.");
|
||||
}
|
||||
}
|
||||
|
||||
void savePeriod(Duration period) {
|
||||
@@ -223,6 +245,7 @@ class HomeCaptainController extends GetxController {
|
||||
await getlocation();
|
||||
onButtonSelected();
|
||||
getDriverRate();
|
||||
addCustomCarIcon();
|
||||
getKazanPercent();
|
||||
getPaymentToday();
|
||||
getCountRideToday();
|
||||
|
||||
@@ -105,8 +105,8 @@ class MapDriverController extends GetxController {
|
||||
late LatLng latLngPassengerDestination = LatLng(0, 0);
|
||||
|
||||
void onMapCreated(GoogleMapController controller) async {
|
||||
myLocation = Get.find<LocationController>().location as LatLng;
|
||||
myLocation = myLocation;
|
||||
myLocation = Get.find<LocationController>().myLocation;
|
||||
// myLocation = myLocation;
|
||||
mapController = controller;
|
||||
controller.getVisibleRegion();
|
||||
controller.animateCamera(
|
||||
@@ -454,9 +454,10 @@ class MapDriverController extends GetxController {
|
||||
}
|
||||
|
||||
addWaitingTimeCostFromPassengerToDriverWallet() async {
|
||||
double distance2 = calculateDistanceBetweenDriverAndPassengerLocation();
|
||||
double distance2 =
|
||||
await calculateDistanceBetweenDriverAndPassengerLocation();
|
||||
|
||||
if (distance2 > 40) {
|
||||
if (distance2 > 60) {
|
||||
Get.defaultDialog(
|
||||
title: 'Your are far from passenger location'.tr,
|
||||
middleText:
|
||||
@@ -893,12 +894,11 @@ class MapDriverController extends GetxController {
|
||||
|
||||
void addCustomCarIcon() {
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio
|
||||
// scale: 1.0,
|
||||
);
|
||||
size: const Size(30, 35), devicePixelRatio: Get.pixelRatio);
|
||||
BitmapDescriptor.asset(
|
||||
config,
|
||||
'assets/images/car.png',
|
||||
// mipmaps: false,
|
||||
).then((value) {
|
||||
carIcon = value;
|
||||
update();
|
||||
@@ -999,11 +999,10 @@ class MapDriverController extends GetxController {
|
||||
LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);
|
||||
|
||||
// Create the LatLngBounds object
|
||||
LatLngBounds boundsData =
|
||||
LatLngBounds(northeast: northeast, southwest: southwest);
|
||||
boundsData = LatLngBounds(northeast: northeast, southwest: southwest);
|
||||
|
||||
// Fit the camera to the bounds
|
||||
var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140);
|
||||
var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData!, 140);
|
||||
mapController!.animateCamera(cameraUpdate);
|
||||
update();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user