This commit is contained in:
Hamza-Ayed
2024-05-02 12:07:38 +03:00
parent 8684223b6a
commit 9d3c522038
14 changed files with 601 additions and 460 deletions

View File

@@ -1,4 +1,5 @@
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/controller/functions/crud.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/colors.dart';
@@ -11,6 +12,7 @@ import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:SEFER/views/widgets/mycircular.dart';
import '../../../constant/links.dart';
import '../../../controller/functions/gemeni.dart';
class AiPage extends StatelessWidget {
@@ -21,46 +23,20 @@ class AiPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MyScafolld(
title: 'AI Page'.tr,
title: 'Documents check'.tr,
body: [
box.read(BoxName.countryCode) == 'USA'
? Positioned(
top: 3,
left: Get.width * .2,
right: Get.width * .2,
child: MyElevatedButton(
title: 'Take Picture Of ID Card'.tr,
onPressed: () {
scanDocumentsByApi.scanDocumentsByApi();
},
))
: box.read(BoxName.countryCode) == 'Jordan'
? Positioned(
top: 3,
left: Get.width * .1,
right: Get.width * .1,
child: MyElevatedButton(
title: 'Take Picture Of Driver License Card'.tr,
onPressed: () {
contentController.getDriverLicenseJordanContent();
},
))
: Positioned(
top: 3,
left: Get.width * .1,
right: Get.width * .1,
child: MyElevatedButton(
title: 'Take Picture Of Driver License Card'.tr, //egypt
onPressed: () {
contentController
.getDriverLicenseJordanContent(); //egypt
},
)),
box.read(BoxName.countryCode) == 'USA'
? usaDriverLicensWidget()
: box.read(BoxName.countryCode) == 'Jordan'
? jordanDriverLicenseWidget()
: egyptDriverLicenseWidget()
// box.read(BoxName.countryCode) == 'USA'
// ? UsaAiDocuments(scanDocumentsByApi: scanDocumentsByApi)
// : box.read(BoxName.countryCode) == 'Jordan'
// ? JordanDocumants(contentController: contentController)
// :
// EgyptDocuments(contentController: contentController),
// box.read(BoxName.countryCode) == 'USA'
// ? usaDriverLicensWidget()
// : box.read(BoxName.countryCode) == 'Jordan'
// ? jordanDriverLicenseWidget()
// :
egyptDriverLicenseWidget()
],
isleading: true);
}
@@ -87,14 +63,14 @@ class AiPage extends StatelessWidget {
child: ListView(
children: [
Container(
decoration: AppStyle.boxDecoration,
decoration: AppStyle.boxDecoration1,
// height: Get.height * .4,
child: Padding(
padding: const EdgeInsets.all(5),
child: contentController.responseMap.isEmpty
? Center(
child: Text(
'There is no data yet.'.tr,
'Take Picture Of ID Card'.tr,
style: AppStyle.title,
),
)
@@ -318,45 +294,6 @@ class AiPage extends StatelessWidget {
)
]))
: const SizedBox()
// MyElevatedButton(
// title: 'Detect Your Face '.tr,
// onPressed: () => scanDocumentsByApi
// .checkMatchFaceApi(),
// ),
// scanDocumentsByApi.res.isEmpty
// ? const SizedBox()
// : scanDocumentsByApi.res['data']
// ['result']
// .toString() ==
// 'Same'
// ? MyElevatedButton(
// onPressed: () async {
// await registerCaptainController
// .register();
// await registerCaptainController
// .addLisence();
// // await scanDocumentsByApi
// // .uploadImagePortrate();
// },
// title:
// 'Go to next step\nscan Car License.'
// .tr,
// kolor: AppColor.greenColor,
// )
// : const SizedBox(),
// MyElevatedButton(
// title: 'get sql data',
// kolor: AppColor.yellowColor,
// onPressed: () {
// sql.deleteAllData(
// TableName.faceDetectTimes);
// sql
// .getAllData(
// TableName.faceDetectTimes)
// .then((value) => print(
// value[0]['faceDetectTimes']));
// },
// ),
],
),
),
@@ -378,14 +315,22 @@ class AiPage extends StatelessWidget {
: Column(
children: [
Container(
decoration: AppStyle.boxDecoration,
decoration: AppStyle.boxDecoration1,
height: Get.height * .35,
child: Padding(
padding: const EdgeInsets.all(5),
child: Center(
child: Text(
'There is no data yet.'.tr,
style: AppStyle.title,
child: InkWell(
onTap: () async {
await CRUD().allMethodForAI(
'name,address,dob,nationalNo,',
AppLink.uploadEgypt,
'idFront'); //egypt
},
child: Text(
'Take Picture Of ID Card'.tr,
style: AppStyle.title,
),
),
)),
),
@@ -962,3 +907,73 @@ Output the extracted information in the following JSON formate and make date for
);
}
}
class EgyptDocuments extends StatelessWidget {
const EgyptDocuments({
super.key,
required this.contentController,
});
final AI contentController;
@override
Widget build(BuildContext context) {
return Positioned(
top: 3,
left: Get.width * .1,
right: Get.width * .1,
child: MyElevatedButton(
title: 'Take Picture Of ID Card'.tr, //egypt
onPressed: () async {
await CRUD().allMethodForAI('name,address,dob,nationalNo,',
AppLink.uploadEgypt, 'idFront'); //egypt
},
));
}
}
class JordanDocumants extends StatelessWidget {
const JordanDocumants({
super.key,
required this.contentController,
});
final AI contentController;
@override
Widget build(BuildContext context) {
return Positioned(
top: 3,
left: Get.width * .1,
right: Get.width * .1,
child: MyElevatedButton(
title: 'Take Picture Of Driver License Card'.tr,
onPressed: () {
contentController.getDriverLicenseJordanContent();
},
));
}
}
class UsaAiDocuments extends StatelessWidget {
const UsaAiDocuments({
super.key,
required this.scanDocumentsByApi,
});
final ScanDocumentsByApi scanDocumentsByApi;
@override
Widget build(BuildContext context) {
return Positioned(
top: 3,
left: Get.width * .2,
right: Get.width * .2,
child: MyElevatedButton(
title: 'Take Picture Of ID Card'.tr,
onPressed: () {
scanDocumentsByApi.scanDocumentsByApi();
},
));
}
}