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

@@ -33,7 +33,5 @@ class AK {
static final String payPalSecret = Env.payPalSecret;
static final String geminiApi = Env.geminiApi;
static const String agoraAppId = '12994c6e707543e68d5638894d04f989';
static const String agoraChannelName = 'sefer1';
static const String agoraToken =
'007eJxTYAjpCZ9yKVn8k5S5blKObpxhXtrE5vXtO0+cEjrxUnR3cZ8Cg6GRpaVJslmquYG5qYlxqplFiqmZsYWFpUmKgUmapYVlVeGF1IZARoZFOjkMjFAI4rMxFKempRYZMjAAABlgHmg=';
static const String agoraAppCertificate = 'e21a388f83034a159f2783889a6d7bcf';
}

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)

View File

@@ -5,7 +5,9 @@ import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:get/get.dart';
import '../../../constant/box_name.dart';
import '../../../constant/char_map.dart';
import '../../../constant/colors.dart';
import '../../../constant/credential.dart';
import '../../../constant/info.dart';
import '../../../constant/style.dart';
import '../../../controller/auth/captin/login_captin_controller.dart';
@@ -195,60 +197,62 @@ class LoginCaptin extends StatelessWidget {
stopPauseOnTap: true,
),
// IconButton(
// onPressed: () async {
// // String v =
// // await storage.read(key: BoxName.serverAPI) ?? '';
// // print(v);
// // sql.deleteAllData(TableName.faceDetectTimes);
// AC credentials = AC();
// // String apiKey = AK.secretKey;
// // // // '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';
// // credentials.gAK();
// // String? apiKeyf =
// // await storage.read(key: BoxName.chatGPTkey);
// // print(apiKeyf);
// // String convertedString = credentials.c(apiKey, s);
// // String convertedStrings = credentials.c(apiKey, s);
// // print('Converted String s: $convertedStrings');
// // String convertedStringC =
// // credentials.c(convertedStrings, c);
// // print('v: $v');
// // 'AAAAinYllCo:APA91bF1shTpzSsSxqbfY6c60D8zs1ZsdIsl9ix6nl7GDdjCqWPRK0G0ub5SqFdb1jDpQDvQPxGg-697MWLo0sy3oYImBwBLObyhk0GjtNzyr0PbE3hI-pOvhf8Vp1xgUgBmofbZYXkH'
// // 'AAAAinYllCo:APA91bF1shTpzSsSxqbfY6c60D8zs1ZsdIsl9ix6nl7GDdjCqWPRK0G0ub5SqFdb1jDpQDvQPxGg-697MWLo0sy3oYImBwBLObyhk0GjtNzyr0PbE3hI-pOvhf8Vp1xgUgBmofbZYXkH'
// String convertedStringN = credentials.c(
// credentials.c(
// credentials.c(
// '0vQRyaYYDWpsv73A5CZOknseK7S2sgwE', cs),
// cC),
// cn);
// print('Converted v: $convertedStringN');
// // //
// // String retrievedStringN =
// // credentials.r(convertedStringN, n);
// // print('Retrieved String: $retrievedStringN');
// // String retrievedStringC =
// // credentials.r(retrievedStringN, c);
// // print('Retrieved String: $retrievedStringC');
// onPressed: () async {
// // String v =
// // await storage.read(key: BoxName.serverAPI) ?? '';
// // print(v);
// // sql.deleteAllData(TableName.faceDetectTimes);
// AC credentials = AC();
// String apiKey =
// 'Qfrhx9d5YVHiy4uEuK4wiFc9kIuFFlvc5A6WVzPK';
// // // // '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';
// // credentials.gAK();
// String? apiKeyf =
// await storage.read(key: BoxName.chatGPTkey);
// print(apiKeyf);
// String convertedString = credentials.c(apiKey, s);
// String convertedStrings = credentials.c(apiKey, s);
// print('Converted String s: $convertedStrings');
// String convertedStringC =
// credentials.c(convertedStrings, c);
// print('v: $v');
// 'AAAAinYllCo:APA91bF1shTpzSsSxqbfY6c60D8zs1ZsdIsl9ix6nl7GDdjCqWPRK0G0ub5SqFdb1jDpQDvQPxGg-697MWLo0sy3oYImBwBLObyhk0GjtNzyr0PbE3hI-pOvhf8Vp1xgUgBmofbZYXkH'
// 'AAAAinYllCo:APA91bF1shTpzSsSxqbfY6c60D8zs1ZsdIsl9ix6nl7GDdjCqWPRK0G0ub5SqFdb1jDpQDvQPxGg-697MWLo0sy3oYImBwBLObyhk0GjtNzyr0PbE3hI-pOvhf8Vp1xgUgBmofbZYXkH'
// String convertedStringN = credentials.c(
// credentials.c(
// credentials.c(
// 'ASCeQiScKwmkMyjlrr7l0tT57Br2yPRAgm5xZndjnusED53JA0us1DbqJaJXDVWFCtAHapjVqA5FEEPL',
// cs),
// cC),
// cn);
// print('Converted v: $convertedStringN');
// //
// String retrievedStringN =
// credentials.r(convertedStringN, n);
// print('Retrieved String: $retrievedStringN');
// String retrievedStringC =
// credentials.r(retrievedStringN, c);
// print('Retrieved String: $retrievedStringC');
// String retrievedStringS = credentials.r(
// credentials.r(
// credentials.r(convertedStringN, cn), cC),
// cs);
// print('Retrieved String: $retrievedStringS');
// // if (retrievedStringS == apiKey) {
// // print('same');
// // }
// // print(' AK is ' + AK.chatGPTkey); //
// // print(' ENV is ' + Env.chatGPTkey); //
// // // print('storage is ' + v); //
// // print('storage is ' + apiKeyf!); //
// },
// icon: const Icon(
// Icons.close,
// color: AppColor.blueColor,
// ),
// String retrievedStringS = credentials.r(
// credentials.r(
// credentials.r(convertedStringN, cn), cC),
// cs);
// print('Retrieved String: $retrievedStringS');
//
// if (retrievedStringS == apiKey) {
// print('same');
// }
// print(' AK is ' + AK.chatGPTkey); //
//
// print(' ENV is ' + Env.chatGPTkey); //
// // print('storage is ' + v); //
// print('storage is ' + apiKeyf!); //
// },
// icon: const Icon(
// Icons.close,
// color: AppColor.blueColor,
// ),
// ),
],
),

View File

@@ -69,8 +69,7 @@ class DrawerCaptain extends StatelessWidget {
horizontal: 4, vertical: 1),
color: AppColor.greenColor,
child: RatingBar.builder(
initialRating: double.parse(
Get.find<HomeCaptainController>().rating),
initialRating: 5,
minRating: 1,
direction: Axis.horizontal,
itemCount: 5,

View File

@@ -67,7 +67,7 @@ GetBuilder<MapDriverController> driverEndRideBar() {
Text(
'${mapDriverController.recentDistanceToDash.toStringAsFixed(0)} ${'KM'.tr}'),
const Icon(Icons.attach_money),
Text(mapDriverController.price.toStringAsFixed(0)),
Text(mapDriverController.price.toStringAsFixed(2)),
],
),
(mapDriverController.carType == 'Free Ride' ||