This commit is contained in:
Hamza-Ayed
2024-02-25 17:27:28 +03:00
parent b33e797f76
commit e2cdf18b59
9 changed files with 114 additions and 45 deletions

View File

@@ -26,6 +26,7 @@ class HomeCaptainController extends GetxController {
bool isLoading = true;
bool isCallOn = false;
String totalMoneyToday = '0';
String countRideToday = '0';
String totalMoneyInSEFER = '0';
String totalDurationToday = '0';
Timer? timer;
@@ -196,6 +197,7 @@ class HomeCaptainController extends GetxController {
await getlocation();
onButtonSelected();
getPaymentToday();
getCountRideToday();
getAllPayment();
startPeriodicExecution();
onMapCreated(mapHomeCaptaiController!);
@@ -224,6 +226,17 @@ class HomeCaptainController extends GetxController {
update();
}
getCountRideToday() async {
var res = await CRUD().get(
link: AppLink.getCountRide,
payload: {'driver_id': box.read(BoxName.driverID).toString()});
data = jsonDecode(res);
countRideToday = data['message'][0]['count'].toString();
// print(countRideToday);
update();
}
getAllPayment() async {
var res = await CRUD().get(
link: AppLink.getAllPaymentFromRide,

View File

@@ -290,6 +290,7 @@ class MapDriverController extends GetxController {
return d['message'][0]['count'];
}
Position? currentPosition;
void startRideFromDriver() async {
changeRideToBeginToPassenger();
isPassengerInfoWindow = false;
@@ -325,7 +326,37 @@ class MapDriverController extends GetxController {
'driverID': box.read(BoxName.driverID).toString(),
});
var d = jsonDecode(res);
mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 18));
// mapController!.animateCamera(
// CameraUpdate.newLatLngZoom(
// myLocation,
// 12,
// ),
// );
StreamSubscription<Position>? locationSubscription;
try {
locationSubscription =
Geolocator.getPositionStream().listen((Position position) {
currentPosition = position;
// Update camera position on the map
mapController!.animateCamera(
CameraUpdate.newCameraPosition(
CameraPosition(
target: LatLng(position.latitude, position.longitude),
zoom: 7,
),
),
);
}); // Stop listening to GPS updates when the ride is finished
if (!isRideBegin) {
locationSubscription?.cancel();
}
} catch (error) {
debugPrint('Error listening to GPS: $error');
// Handle GPS errors gracefully, e.g., show a user-friendly message
}
update();
print('...................');
print(d);

View File

@@ -564,6 +564,10 @@ class MyTranslation extends Translations {
'from 12:00 till 15:00 (Thursday, Friday, Saturday, Monday)':
"من 12:00 إلى 15:00 (يوم الخميس، الجمعة، السبت، الإثنين)",
'Night': "الليل",
'You have in account': 'يوجد في حسابك ',
'Ride Today :': 'عدد الرحلات : ',
'After this period\nYou can\'t cancel!':
'بعد هذه الفتره \nلا تستطيع الغاء الرحله',
'from 23:59 till 05:30': "من 23:59 إلى 05:30",
'Rate Driver': "تقييم السائق",
'Total Cost is ': ' صافي الربح ',

View File

@@ -15,7 +15,7 @@ class DriverWalletHistoryController extends GetxController {
update();
var res = await CRUD().get(
link: AppLink.getWalletByDriver,
payload: {'driver_id': box.read(BoxName.driverID)});
payload: {'driverID': box.read(BoxName.driverID)});
archive = jsonDecode(res)['message'];
print(archive);