25-7-28-2
This commit is contained in:
211
lib/views/auth/captin/criminal_documents_page.dart
Executable file
211
lib/views/auth/captin/criminal_documents_page.dart
Executable file
@@ -0,0 +1,211 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/functions/encrypt_decrypt.dart';
|
||||
import '../../../controller/functions/gemeni.dart';
|
||||
import '../../../controller/functions/tts.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../widgets/elevated_btn.dart';
|
||||
import '../../widgets/my_scafold.dart';
|
||||
|
||||
class CriminalDocumemtPage extends StatelessWidget {
|
||||
const CriminalDocumemtPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(AI());
|
||||
return MyScafolld(
|
||||
title: "Criminal Document".tr,
|
||||
isleading: false,
|
||||
body: [
|
||||
GetBuilder<AI>(builder: (controller) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text('You have upload Criminal documents'.tr),
|
||||
)),
|
||||
egyptCriminalRecord(),
|
||||
controller.responseCriminalRecordEgypt.isNotEmpty
|
||||
? MyElevatedButton(
|
||||
title: 'Next'.tr,
|
||||
onPressed: () async {
|
||||
if ((controller
|
||||
.responseCriminalRecordEgypt['FullName']) !=
|
||||
box.read(BoxName.nameArabic)) //todo get from server
|
||||
{
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Criminal Record Mismatch',
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.warning,
|
||||
size: 48, color: Colors.red),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'The full name on your criminal record does not match the one on your driver’s license. Please verify and provide the correct documents.'
|
||||
.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await Get.find<TextToSpeechController>()
|
||||
.speakText(
|
||||
'The full name on your criminal record does not match the one on your driver’s license. Please verify and provide the correct documents.'
|
||||
.tr,
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.volume_up),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
await controller.addCriminalDocuments();
|
||||
}
|
||||
})
|
||||
: const SizedBox(),
|
||||
],
|
||||
);
|
||||
})
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
GetBuilder<AI> egyptCriminalRecord() {
|
||||
return GetBuilder<AI>(
|
||||
builder: (ai) {
|
||||
if (ai.responseCriminalRecordEgypt.isNotEmpty) {
|
||||
return Card(
|
||||
elevation: 4.0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('Criminal Record'.tr, style: AppStyle.headTitle2),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await ai.allMethodForAI(
|
||||
"""
|
||||
Write a JSON object from the following information extracted from the provided Arabic text:
|
||||
|
||||
{
|
||||
"InspectionResult": "",
|
||||
"NationalID": "",
|
||||
"FullName": "",
|
||||
"IssueDate": "" // Format: YYYY-MM-DD
|
||||
}
|
||||
|
||||
Important notes:
|
||||
1. For the IssueDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
|
||||
2. Add appropriate spaces in all text fields to ensure readability.
|
||||
3. If any information is missing, leave the corresponding field as an empty string.
|
||||
4. Ensure all text is properly formatted and spaces are used correctly.
|
||||
5. Convert any Arabic numerals to Latin numerals (0-9) where applicable.
|
||||
|
||||
Please fill in the JSON object with the extracted information, following these guidelines.
|
||||
""",
|
||||
AppLink.uploadEgypt,
|
||||
'criminalRecord',
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.refresh),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
const Divider(color: AppColor.accentColor),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'${'InspectionResult'.tr}: ${(ai.responseCriminalRecordEgypt['InspectionResult'])}'),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'${'FullName'.tr}: ${(ai.responseCriminalRecordEgypt['FullName'])}',
|
||||
style: AppStyle.title.copyWith(
|
||||
color: (ai.responseCriminalRecordEgypt['FullName']) ==
|
||||
(ai.responseIdEgyptDriverLicense['name_arabic'])
|
||||
? AppColor.greenColor
|
||||
: AppColor.redColor),
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'${'NationalID'.tr}: ${(ai.responseCriminalRecordEgypt['NationalID'])}'),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'${'IssueDate'.tr}: ${ai.responseCriminalRecordEgypt['IssueDate']}'),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Card(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
await ai.allMethodForAI(
|
||||
"""
|
||||
Write a JSON object from the following information extracted from the provided Arabic text:
|
||||
|
||||
{
|
||||
"InspectionResult": "",
|
||||
"NationalID": "",
|
||||
"FullName": "",
|
||||
"IssueDate": "" // Format: YYYY-MM-DD
|
||||
}
|
||||
|
||||
Important notes:
|
||||
1. For the IssueDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
|
||||
2. Add appropriate spaces in all text fields to ensure readability.
|
||||
3. If any information is missing, leave the corresponding field as an empty string.
|
||||
4. Ensure all text is properly formatted and spaces are used correctly.
|
||||
5. Convert any Arabic numerals to Latin numerals (0-9) where applicable.
|
||||
|
||||
Please fill in the JSON object with the extracted information, following these guidelines.
|
||||
""",
|
||||
AppLink.uploadEgypt,
|
||||
'criminalRecord',
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/6.png',
|
||||
height: Get.height * .25,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fitHeight,
|
||||
),
|
||||
Text(
|
||||
'Capture an Image of Your Criminal Record'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user