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

@@ -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');
// }
// }
// }