This commit is contained in:
Hamza-Ayed
2024-06-22 13:12:35 +03:00
parent 1cc0156cfd
commit 3c5321f70b
67 changed files with 91 additions and 740 deletions

View File

@@ -31,9 +31,6 @@ class CallController extends GetxController {
}
initAgoraFull() async {
print('channelName is $channelName');
print('remoteid is $remoteUid');
print('uid is $uid');
await fetchToken();
// Set up an instance of Agora engine
setupVoiceSDKEngine();
@@ -65,8 +62,6 @@ class CallController extends GetxController {
//create an instance of the Agora engine
agoraEngine = createAgoraRtcEngine();
await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId));
print('eeeeeeeeeeeeeeeeeeee');
print(agoraEngine);
// Register the event handler
agoraEngine.registerEventHandler(
RtcEngineEventHandler(
@@ -129,7 +124,6 @@ class CallController extends GetxController {
var res = await CRUD()
.getAgoraToken(channelName: channelName, uid: uid.toString());
token = res;
print('token is $token');
update();
}
}

View File

@@ -91,10 +91,7 @@ class CameraClassController extends GetxController {
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
} else {
print(response.reasonPhrase);
}
} else {}
}
Future<String> uploadImage(File imageFile) async {
@@ -164,12 +161,9 @@ class CameraClassController extends GetxController {
update();
// Print the JSON output
print(jsonOutput);
// Get.back();
} catch (e) {
print('Error capturing image: $e');
}
} catch (e) {}
}
String getTextAsJSON(String text) {
@@ -228,11 +222,8 @@ class CameraClassController extends GetxController {
// textBlocks.toString(); // Convert the extracted text to JSON.
// // Print the JSON to the console.
// print(jsonText);
// update();
// // print(text);
// } catch (e) {
// print('Error during text extraction: $e');
// scannedText = '';
// }
// }

View File

@@ -27,15 +27,9 @@ class CRUD {
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
},
);
print("-----request----" + response.request.toString());
// print("-----headers-----" + response.headers.toString());
print("-----payload-----" + payload.toString());
// if (response.statusCode == 200) {
// print(response.body);
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
print(jsonData);
return response.body;
}
@@ -55,11 +49,8 @@ class CRUD {
if (res.statusCode == 200) {
var response = jsonDecode(res.body);
print(await response);
return response['token'];
} else {
print(res.reasonPhrase);
}
} else {}
}
Future<dynamic> getLlama({
@@ -105,10 +96,8 @@ class CRUD {
Future.delayed(const Duration(seconds: 2));
var extractedString =
await arabicTextExtractByVisionAndAI(imagePath: imagePath);
// print(extractedString);
var json = jsonDecode(extractedString);
var textValues = extractTextFromLines(json);
print(textValues);
// await Get.put(AI()).geminiAiExtraction(prompt, textValues);
await Get.put(AI()).anthropicAI(textValues, prompt, imagePath);
}
@@ -152,11 +141,8 @@ class CRUD {
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
// print(await response.stream.bytesToString());
return await response.stream.bytesToString();
} else {
print(response.reasonPhrase);
}
} else {}
}
Future<dynamic> getChatGPT({
@@ -210,12 +196,8 @@ class CRUD {
},
);
if (response.statusCode == 200) {
print(response);
return response.body;
} else {
print('eeeeeeeeerrrrorrrr ${response.statusCode}');
print(response.body);
}
} else {}
}
Future<dynamic> post({
@@ -236,11 +218,8 @@ class CRUD {
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
},
);
print(response.request);
print(payload);
var jsonData = jsonDecode(response.body);
print(jsonData);
if (response.statusCode == 200) {
if (jsonData['status'] == 'success') {
return response.body;
@@ -248,7 +227,6 @@ class CRUD {
String errorMessage = jsonData['message'];
// Get.snackbar('Error'.tr, errorMessage.tr,
// backgroundColor: AppColor.redColor);
print(errorMessage.tr);
return (jsonData['status']);
}
} else {
@@ -267,11 +245,8 @@ class CRUD {
);
var response = await http.post(url,
body: payload, headers: {'Content-Type': 'application/json'});
print(response.request);
print(payload);
var jsonData = jsonDecode(response.body);
// print(jsonData);
if (response.statusCode == 200) {
if (jsonData['status'] == 'success') {
return response.body;
@@ -297,13 +272,8 @@ class CRUD {
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
// print(request.body);
// print(response);
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
} else {
print(response.reasonPhrase);
}
} else {}
}
Future<dynamic> postFromDialogue({
@@ -324,9 +294,6 @@ class CRUD {
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
},
);
//print(response.request);
//print('body=========================');
//print(response.body);
if (response.body.isNotEmpty) {
var jsonData = jsonDecode(response.body);
@@ -368,10 +335,7 @@ class CRUD {
);
if (response.statusCode == 201) {
print('Verification request sent');
} else {
print('Failed to send verification request');
}
} else {}
// Prompt the user to enter the OTP
final otpCode = "123456"; // Replace with user input
@@ -394,10 +358,7 @@ class CRUD {
);
if (checkResponse.statusCode == 201) {
print('Verification successful');
} else {
print('Verification failed');
}
} else {}
}
Future<dynamic> getGoogleApi({
@@ -411,9 +372,7 @@ class CRUD {
url,
body: payload,
);
print(response.request);
var jsonData = jsonDecode(response.body);
// //print(jsonData);
if (jsonData['status'] == 'OK') {
return jsonData;
}

View File

@@ -20,6 +20,5 @@ class DeviceController {
deviceSerialNumber = iosInfo.identifierForVendor!;
box.write(BoxName.deviceInfo, deviceSerialNumber.toString());
}
print(deviceSerialNumber);
}
}

View File

@@ -208,20 +208,6 @@ class AI extends GetxController {
Future<void> addDriverEgypt() async {
try {
print(box.read(BoxName.driverID).toString());
print(box.read(BoxName.phoneDriver)?.toString() ?? '');
print(responseIdEgyptBack['gender']);
print(responseIdEgyptDriverLicense['license_type']);
print(responseIdEgyptBack['nationalID']);
print(responseIdEgyptDriverLicense['issue_date']);
print(responseIdEgyptDriverLicense['expiry_date']);
print(responseIdEgyptDriverLicense['license_categories']);
print(responseIdEgyptFront['card_id']);
print(responseIdEgyptDriverLicense['issue_date']);
print(responseIdEgyptFront['dob'] != null
? responseIdEgyptFront['dob'] + '-01-01'.toString()
: '');
// Extract values from box or set defaults
var firstName = responseIdEgyptDriverLicense['firstName'] ?? '';
var lastName = responseIdEgyptDriverLicense['lastName'] ?? '';
@@ -282,7 +268,6 @@ class AI extends GetxController {
'site': site,
'employmentType': employmentType,
};
print(payload);
isLoading = true;
update();
// Make POST request
@@ -292,7 +277,6 @@ class AI extends GetxController {
update();
// Handle response
print(status1);
if (status1['status'] == 'success') {
isDriverSaved = true;
Get.snackbar('Success', 'Driver data saved successfully',
@@ -302,7 +286,6 @@ class AI extends GetxController {
backgroundColor: Colors.red);
}
} catch (e) {
print('Error: $e');
Get.snackbar('Error', 'An error occurred while saving driver data',
backgroundColor: Colors.red);
}
@@ -338,9 +321,7 @@ class AI extends GetxController {
Get.snackbar('Success', 'message',
backgroundColor: AppColor.greenColor);
}
} catch (e) {
print('error is $e');
}
} catch (e) {}
}
final picker = ImagePicker();
@@ -414,10 +395,8 @@ class AI extends GetxController {
Future.delayed(const Duration(seconds: 2));
var extractedString =
await CRUD().arabicTextExtractByVisionAndAI(imagePath: imagePath);
// print(extractedString);
var json = jsonDecode(extractedString);
var textValues = CRUD().extractTextFromLines(json);
print(textValues);
// await Get.put(AI()).geminiAiExtraction(prompt, textValues, imagePath);
await Get.put(AI()).anthropicAI(textValues, prompt, imagePath);
isLoading = false;
@@ -473,7 +452,6 @@ class AI extends GetxController {
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -485,13 +463,9 @@ class AI extends GetxController {
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -499,19 +473,11 @@ class AI extends GetxController {
if (jsonString != null) {
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
print(jsonString);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<dynamic> anthropicAI(
@@ -533,9 +499,6 @@ class AI extends GetxController {
"messages": messagesData,
});
print('requestBody');
print(requestBody);
final response = await http.post(
Uri.parse('https://api.anthropic.com/v1/messages'),
headers: {
@@ -549,29 +512,22 @@ class AI extends GetxController {
if (response.statusCode == 200) {
var responseData = jsonDecode(utf8.decode(response.bodyBytes));
// Process the responseData as needed
print(utf8.decode(response.bodyBytes));
if (idType == 'car_back') {
responseIdCardDriverEgyptBack =
jsonDecode(responseData['content'][0]['text']);
print(responseIdCardDriverEgyptBack);
} else if (idType == 'car_front') {
responseIdCardDriverEgyptFront =
jsonDecode(responseData['content'][0]['text']);
print(responseIdCardDriverEgyptFront);
} else if (idType == 'id_front') {
responseIdEgyptFront = jsonDecode(responseData['content'][0]['text']);
print(responseIdEgyptFront);
} else if (idType == 'id_back') {
responseIdEgyptBack = jsonDecode(responseData['content'][0]['text']);
print(responseIdEgyptBack);
} else if (idType == 'driver_license') {
responseIdEgyptDriverLicense =
jsonDecode(responseData['content'][0]['text']);
print(responseIdEgyptDriverLicense);
} else if (idType == 'criminalRecord') {
responseCriminalRecordEgypt =
jsonDecode(responseData['content'][0]['text']);
print(responseCriminalRecordEgypt);
}
update();
@@ -615,7 +571,6 @@ class AI extends GetxController {
}
]
});
// print(requestBody);
final response = await http.post(
Uri.parse(
@@ -629,12 +584,8 @@ class AI extends GetxController {
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result = responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -645,33 +596,24 @@ class AI extends GetxController {
if (idType == 'car_back') {
responseIdCardDriverEgyptBack = jsonDecode(jsonString);
print(responseIdCardDriverEgyptBack);
} else if (idType == 'car_front') {
responseIdCardDriverEgyptFront = jsonDecode(jsonString);
print(responseIdCardDriverEgyptFront);
} else if (idType == 'id_front') {
responseIdEgyptFront = jsonDecode(jsonString);
print(responseIdEgyptFront);
} else if (idType == 'id_back') {
responseIdEgyptBack = jsonDecode(jsonString);
print(responseIdEgyptBack);
} else if (idType == 'driver_license') {
responseIdEgyptDriverLicense = jsonDecode(jsonString);
print(responseIdEgyptDriverLicense);
}
update();
} else {
print("JSON string not found");
Get.snackbar('Error', "JSON string not found",
backgroundColor: AppColor.redColor);
}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {}
}
Future<void> getDriverLicenseJordanContent() async {
@@ -725,7 +667,6 @@ class AI extends GetxController {
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -738,13 +679,9 @@ class AI extends GetxController {
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -753,21 +690,11 @@ class AI extends GetxController {
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseMap = jsonDecode(jsonString);
print(jsonString);
print(responseMap);
print(responseMap['dob']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<void> getCarLicenseJordanContent() async {
@@ -826,7 +753,6 @@ Output the extracted information in the following JSON format''',
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -840,13 +766,9 @@ Output the extracted information in the following JSON format''',
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -855,21 +777,11 @@ Output the extracted information in the following JSON format''',
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseCarLicenseMapJordan = jsonDecode(jsonString);
print(jsonString);
print(responseCarLicenseMapJordan);
print(responseCarLicenseMapJordan['plate_number']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<void> jordanID() async {
@@ -928,7 +840,6 @@ Output the extracted information in the following JSON format''',
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -941,13 +852,9 @@ Output the extracted information in the following JSON format''',
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -956,21 +863,11 @@ Output the extracted information in the following JSON format''',
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseCarLicenseMapJordan = jsonDecode(jsonString);
print(jsonString);
print(responseCarLicenseMapJordan);
print(responseCarLicenseMapJordan['plate_number']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<void> carLicenseJordan() async {
@@ -1038,7 +935,6 @@ Output the extracted information in the following JSON formate and make date for
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -1051,13 +947,9 @@ Output the extracted information in the following JSON formate and make date for
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -1066,21 +958,11 @@ Output the extracted information in the following JSON formate and make date for
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseCarLicenseMapJordan = jsonDecode(jsonString);
print(jsonString);
print(responseCarLicenseMapJordan);
print(responseCarLicenseMapJordan['plate_number']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future getTextFromCard(String prompt) async {
@@ -1133,7 +1015,6 @@ Output the extracted information in the following JSON formate and make date for
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -1146,13 +1027,9 @@ Output the extracted information in the following JSON formate and make date for
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -1161,21 +1038,11 @@ Output the extracted information in the following JSON formate and make date for
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseBackCarLicenseMap = jsonDecode(jsonString);
// print(jsonString);
print(responseBackCarLicenseMap);
// print(responseCarLicenseMap['plate_number']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<void> generateBackCarLicenseJordanContent() async {
@@ -1229,7 +1096,6 @@ Output the extracted information in the following JSON formate and make date for
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -1242,13 +1108,9 @@ Output the extracted information in the following JSON formate and make date for
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -1257,21 +1119,11 @@ Output the extracted information in the following JSON formate and make date for
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseBackCarLicenseMap = jsonDecode(jsonString);
// print(jsonString);
print(responseBackCarLicenseMap);
// print(responseCarLicenseMap['plate_number']);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
Future<void> getFromCarRegistration() async {
@@ -1323,7 +1175,6 @@ Output the extracted information in the following JSON formate and make date for
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
@@ -1337,7 +1188,6 @@ Output the extracted information in the following JSON formate and make date for
// Process the responseData as needed
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
print(result);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
@@ -1345,19 +1195,11 @@ Output the extracted information in the following JSON formate and make date for
if (jsonString != null) {
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
print(jsonString);
} else {
print("JSON string not found");
}
} else {}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
} else {}
} else {}
}
@override

View File

@@ -4,9 +4,7 @@ import 'dart:io';
void showInBrowser(String url) async {
if (await canLaunchUrl(Uri.parse(url))) {
launchUrl(Uri.parse(url));
} else {
print('Could not launch $url');
}
} else {}
}
void launchCommunication(
@@ -30,7 +28,6 @@ void launchCommunication(
'mailto:$contactInfo?subject=Subject&body=${Uri.encodeComponent(message)}';
break;
default:
print('Method not supported on iOS');
return;
}
} else if (Platform.isAndroid) {
@@ -49,7 +46,6 @@ void launchCommunication(
url =
'whatsapp://send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
} else {
print('WhatsApp is not installed on this device.');
// Provide an alternative action, such as opening the WhatsApp Web API
url =
'https://api.whatsapp.com/send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
@@ -60,19 +56,13 @@ void launchCommunication(
'mailto:$contactInfo?subject=Subject&body=${Uri.encodeComponent(message)}';
break;
default:
print('Method not supported on Android');
return;
}
} else {
print('Platform not supported');
return;
}
print('Launching URL: $url');
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
} else {
print('Could not launch $url');
}
} else {}
}

View File

@@ -6,21 +6,15 @@ import 'package:SEFER/controller/functions/gemeni.dart';
class LlamaAi {
Future<Map> getCarRegistrationData(String input, prompt) async {
print(true);
Map exrtatDataFinal = {};
String oneLine = input.replaceAll('\n', ' ');
// print(oneLine);
// var res = await CRUD().getLlama(link: AppLink.gemini, payload: oneLine);
var res = await CRUD()
.getLlama(link: AppLink.llama, payload: oneLine, prompt: prompt);
print(res);
var decod = jsonDecode(res.toString());
print(decod);
// exrtatDataFinal = jsonDecode(extractDataFromJsonString(decod['choices']));
extractDataFromJsonString(decod['choices'][0]['message']['content']);
print(jsonEncode(exrtatDataFinal));
print(false);
return exrtatDataFinal;
}
@@ -38,7 +32,6 @@ class LlamaAi {
// Return the extracted data
// print(jsonEncode(jsonData));
return jsonEncode(jsonData);
}
}

View File

@@ -29,7 +29,6 @@ class LocationBackgroundController extends GetxController {
BackgroundLocation.startLocationService();
BackgroundLocation.getLocationUpdates((location) {
// Handle location updates here
print("New location: ${location.latitude}, ${location.longitude}");
});
}
@@ -47,21 +46,9 @@ class LocationBackgroundController extends GetxController {
BackgroundLocation.setAndroidConfiguration(
Duration.microsecondsPerSecond); // Set interval to 5 seconds
BackgroundLocation.getLocationUpdates((location1) {
print('''\n
Latitude: ${location1.latitude.toString()}
Longitude: ${location1.longitude.toString()}
Altitude: ${location1.altitude.toString()}
Accuracy: ${location1.accuracy.toString()}
Bearing: ${location1.bearing.toString()}
Speed: ${location1.speed.toString()}
''');
});
BackgroundLocation.getLocationUpdates((location1) {});
} else {
await Permission.locationAlways.request();
print('Location permission not granted');
}
}
}

View File

@@ -49,12 +49,8 @@ class LocationController extends GetxController {
try {
totalPoints = Get.find<CaptainWalletController>().totalPoints;
isActive = Get.find<HomeCaptainController>().isActive;
print('isActive $isActive');
print(totalPoints);
if (isActive) {
if (double.parse(totalPoints) > -300) {
print('total point is $totalPoints');
await getLocation();
// if (box.read(BoxName.driverID) != null) {
@@ -110,7 +106,6 @@ class LocationController extends GetxController {
// }
} catch (e) {
// Handle the error gracefully
print('Error during location updates: $e');
}
});
}
@@ -162,21 +157,12 @@ class LocationController extends GetxController {
if (previousTime > 0) {
double distance = calculateDistanceInKmPerHour(
previousTime, _locationData.time, speed);
print('distance $distance');
totalDistance += distance;
}
// print('totalDistance: $totalDistance');
previousTime = _locationData.time!;
}
// Print location details
// print('myLocation: ${myLocation}');
// print('Accuracy: ${_locationData.accuracy}');
// print('Latitude: ${_locationData.latitude}');
// print('Longitude: ${_locationData.longitude}');
// print('Time: ${_locationData.time}');
print('speed: ${_locationData.speed}');
// print('Heading: ${_locationData.heading}');
// isLoading = false;
update();
}

View File

@@ -1,7 +1,6 @@
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart';
@@ -83,11 +82,8 @@ import 'launch.dart';
// // textBlocks.toString(); // Convert the extracted text to JSON.
//
// // // Print the JSON to the console.
// // print(jsonText);
// // update();
// // // print(text);
// // } catch (e) {
// // print('Error during text extraction: $e');
// // extractedText = '';
// // }
// // }
@@ -214,8 +210,6 @@ import 'launch.dart';
// decode = jsonDecode(jsonOutput!);
//
// update();
// print('jsonOutput------------------------------');
// print(scannedText);
// }
// }
@@ -287,7 +281,6 @@ class ScanDocumentsByApi extends GetxController {
// String? visionApi = await storage.read(key: BoxName.visionApi);
// String? visionApi = AK.visionApi;
// Pick an image from the camera or gallery
// print(visionApi);
image = await imagePicker.pickImage(source: ImageSource.camera); //
// If no image was picked, return
@@ -351,12 +344,9 @@ class ScanDocumentsByApi extends GetxController {
// Handle error or provide a default value
}
// print(responseMap);
isLoading = false;
update();
} else {
print(response.reasonPhrase);
}
} else {}
}
late int times;
@@ -425,13 +415,9 @@ class ScanDocumentsByApi extends GetxController {
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
print('Request: ${request.toString()}');
print('Response Status Code: ${response.statusCode}');
print('Response Reason Phrase: ${response.reasonPhrase}');
if (response.statusCode == 200) {
res = jsonDecode(await response.stream.bytesToString());
print(res);
update();
res['data']['result'].toString().contains('No face detected in image')
@@ -494,9 +480,7 @@ class ScanDocumentsByApi extends GetxController {
// },
kolor: AppColor.greenColor,
));
} else {
print(response.reasonPhrase);
}
} else {}
}
// Todo upload images and fields
@@ -529,7 +513,6 @@ class ScanDocumentsByApi extends GetxController {
update();
// Print the response string
print(responseString);
return responseString;
}
@@ -540,9 +523,7 @@ class ScanDocumentsByApi extends GetxController {
// initializeCamera(0);
sql.getAllData(TableName.faceDetectTimes).then((value) {
if (value.isEmpty) {
print(value);
times = 0;
print(times);
update();
// sql.insertData({'faceDetectTimes': 1}, TableName.faceDetectTimes);
} else {
@@ -620,7 +601,6 @@ class ScanDocumentsByApi extends GetxController {
//
// extractedData['extractedTextWithCoordinates'] =
// extractedTextWithCoordinates;
// print(jsonEncode(extractedData));
// return extractedData;
// }
// }
@@ -636,9 +616,7 @@ class ScanDocumentsByApi extends GetxController {
// extractedTextWithCoordinates =
// extractedData['extractedTextWithCoordinates'];
// update(); // Notify GetX that the state has changed
// print(extractedTextWithCoordinates);
// } catch (e) {
// print('Passport data extraction failed: $e');
// }
// }
// }

View File

@@ -28,10 +28,6 @@ class SmsEgyptController extends GetxController {
headers: headers,
);
print(res.reasonPhrase);
print(res.request);
print(res.body);
print(body);
if (res.statusCode == 200) {
Get.defaultDialog(
title: 'You will recieve code in sms message'.tr,
@@ -53,7 +49,6 @@ class SmsEgyptController extends GetxController {
},
headers: headers,
);
print(res);
}
Future sendSmsWithValidaty(String phone, otp) async {
@@ -71,7 +66,6 @@ class SmsEgyptController extends GetxController {
},
headers: headers,
);
print(res);
}
Future sendSmsStatus(String smsid) async {
@@ -84,6 +78,5 @@ class SmsEgyptController extends GetxController {
},
headers: headers,
);
print(res);
}
}

View File

@@ -47,7 +47,6 @@ class TextToSpeechController extends GetxController {
} catch (error) {
// Handle error gracefully, e.g., show a message
Get.snackbar('Error', 'Failed to speak text: $error');
print('Failed to speak text: $error');
}
}
}

View File

@@ -17,7 +17,6 @@
// messageBody: message,
// );
// } catch (e) {
// print(e); // Print the exception to the console.
// }
// }
// }

View File

@@ -54,7 +54,6 @@ class ImageController extends GetxController {
update();
// Save the cropped image
File savedCroppedImage = File(croppedFile!.path);
print('link =$link');
try {
await uploadImage(
savedCroppedImage,
@@ -68,7 +67,6 @@ class ImageController extends GetxController {
} catch (e) {
Get.snackbar('Image Upload Failed'.tr, e.toString(),
backgroundColor: AppColor.redColor);
print(e);
} finally {
isloading = false;
update();