This commit is contained in:
Hamza Aleghwairyeen
2024-04-06 23:55:04 +03:00
parent c7595de6c3
commit c6b0bf2645
8 changed files with 91 additions and 78 deletions

View File

@@ -49,8 +49,10 @@ class CRUD {
required String uid,
}) async {
var uid = box.read(BoxName.phone) ?? box.read(BoxName.phoneDriver);
var res = await http.get(Uri.parse(
'https://repulsive-pig-rugby-shirt.cyclic.app/token?channelName=$channelName'));
var res = await http.get(
Uri.parse(
'https://repulsive-pig-rugby-shirt.cyclic.app/token?channelName=$channelName'),
headers: {'Authorization': 'Bearer ${AK.agoraAppCertificate}'});
if (res.statusCode == 200) {
var response = jsonDecode(res.body);

View File

@@ -32,7 +32,7 @@ class HomeCaptainController extends GetxController {
double naturePrice = 0;
bool isCallOn = false;
String totalMoneyToday = '0';
String rating = '0';
double? rating = 5;
String rideId = '0';
String countRideToday = '0';
String totalMoneyInSEFER = '0';
@@ -274,11 +274,16 @@ class HomeCaptainController extends GetxController {
var res = await CRUD().get(
link: AppLink.getDriverRate,
payload: {'driver_id': box.read(BoxName.driverID).toString()});
var decod = jsonDecode(res);
// print(decod);
rating = decod['message'][0]['rating'].toString();
// print('rating $rating');
update();
if (res != 'failure') {
var decod = jsonDecode(res);
if (decod['message'][0]['rating'] != null) {
rating = double.parse(decod['message'][0]['rating'].toString());
} else {
rating = 5.0; // Set a default value (e.g., 5.0 for full rating)
}
} else {
rating = 5;
}
}
getAllPayment() async {

View File

@@ -582,7 +582,7 @@ class MapDriverController extends GetxController {
await Future.delayed(const Duration(seconds: 1));
recentDistanceToDash = Get.find<LocationController>().totalDistance;
rideTimerFromBegin = i;
price = carType == 'Comfort' || carType == 'Free Ride'
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)