import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:sefer_admin1/controller/admin/register_captain_controller.dart'; import '../../../../constant/colors.dart'; import '../../../../constant/links.dart'; import '../../../../constant/style.dart'; import '../../widgets/elevated_btn.dart'; import '../../widgets/my_scafold.dart'; import '../../widgets/mycircular.dart'; class RegisterCaptain extends StatelessWidget { RegisterCaptain({super.key}); @override Widget build(BuildContext context) { final controller = Get.put(RegisterCaptainController()); // String text = ''; controller.driveInit(); return MyScafolld( title: 'Documents check'.tr, action: GetBuilder(builder: (controller) { return IconButton( onPressed: () { controller.isLoading = false; controller.update(); }, icon: const Icon(Icons.refresh), ); }), body: [ GetBuilder(builder: (controller) { return controller.isLoading ? const MyCircularProgressIndicator() : Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ (controller.responseIdCardDriverEgyptBack.isNotEmpty && controller.responseIdCardDriverEgyptFront .isNotEmpty && controller.responseIdEgyptFront.isNotEmpty && controller.responseIdEgyptBack.isNotEmpty && controller .responseIdEgyptDriverLicense.isNotEmpty // && // controller // .responseCriminalRecordEgypt.isNotEmpty ) ? MyElevatedButton( title: 'Next'.tr, onPressed: () { controller.addDriverAndCarEgypt(); }) : const SizedBox(), SizedBox( height: (controller.responseIdCardDriverEgyptBack .isNotEmpty && controller.responseIdCardDriverEgyptFront .isNotEmpty && controller .responseIdEgyptFront.isNotEmpty && controller .responseIdEgyptBack.isNotEmpty && controller.responseIdEgyptDriverLicense .isNotEmpty // && // controller.responseCriminalRecordEgypt // .isNotEmpty ) ? Get.height * .7 : Get.height * .85, child: ListView( children: [ egyptDriverLicense(), egyptCarLicenceFront(), egyptCarLicenceBack(), egyptDriverIDFront(), egyptDriverIDBack(), // egyptCriminalRecord(), ], ), ), ], ), ); }), ], isleading: true); } GetBuilder egyptDriverLicense() { return GetBuilder( builder: (ai) { if (ai.responseIdEgyptDriverLicense.isNotEmpty) { final expiryDate = ai.responseIdEgyptDriverLicense['expiry_date']; // Check if the expiry date is before today final today = DateTime.now(); // Try parsing the expiry date. If it fails, set it to null. final expiryDateTime = DateTime.tryParse(expiryDate); final isExpired = expiryDateTime != null && expiryDateTime.isBefore(today); 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('Driver\'s License'.tr, style: AppStyle.headTitle2), IconButton( onPressed: () async { await ai.allMethodForAI(""" Write a JSON object from the following information extracted from the provided Arabic text: { "license_type": "", "national_number": "", "name_arabic": "", "name_english": "", "firstName": "", "lastName": "", "address": "", "issue_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9) "expiry_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9) "employmentType": "", "license_categories": [] } Important notes: 1. Ensure all dates are in the format YYYY-MM-DD using Latin (Western) numerals (0-9), not Arabic numerals. 2. The 'license_categories' should be an array, even if there's only one category. 3. Fill in all fields based on the information provided in the Arabic text. 4. If any information is missing, leave the field as an empty string or empty array as appropriate. """, 'driver_license', ai.driverId); //egypt }, icon: const Icon(Icons.refresh), ), ], ), const SizedBox(height: 8.0), const Divider(color: AppColor.accentColor), const SizedBox(height: 8.0), Text( '${'License Type'.tr}: ${ai.responseIdEgyptDriverLicense['license_type']}', style: AppStyle.title, ), const SizedBox(height: 8.0), Text( '${'National Number'.tr}: ${ai.responseIdEgyptDriverLicense['national_number']}', style: AppStyle.title.copyWith( color: ai.responseIdEgyptDriverLicense[ 'national_number'] == ai.responseIdEgyptBack['nationalID'] ? AppColor.greenColor : AppColor.redColor), ), const SizedBox(height: 8.0), Text( '${'Name (Arabic)'.tr}: ${ai.responseIdEgyptDriverLicense['name_arabic']}', ), const SizedBox(height: 8.0), Text( '${'Name (English)'.tr}: ${ai.responseIdEgyptDriverLicense['name_english']}', ), const SizedBox(height: 8.0), Text( '${'Address'.tr}: ${ai.responseIdEgyptDriverLicense['address']}', ), const SizedBox(height: 8.0), Text( '${'Issue Date'.tr}: ${ai.responseIdEgyptDriverLicense['issue_date']}', ), const SizedBox(height: 8.0), Text( '${'Expiry Date'.tr}: ${ai.responseIdEgyptDriverLicense['expiry_date']}', style: AppStyle.title.copyWith( color: !isExpired ? AppColor.greenColor : AppColor.redColor, ), ), const SizedBox(height: 8.0), Text( '${'License Categories'.tr}: ${ai.responseIdEgyptDriverLicense['license_categories']}', ), ], ), ), ); } return Card( child: InkWell( onTap: () async { await ai.allMethodForAI(""" Write a JSON object from the following information extracted from the provided Arabic text: { "license_type": "", "national_number": "", "name_arabic": "", "name_english": "", "firstName": "", "lastName": "", "address": "", "issue_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9) "expiry_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9) "employmentType": "", "license_categories": [] } Important notes: 1. Ensure all dates are in the format YYYY-MM-DD using Latin (Western) numerals (0-9), not Arabic numerals. 2. The 'license_categories' should be an array, even if there's only one category. 3. Fill in all fields based on the information provided in the Arabic text. 4. If any information is missing, leave the field as an empty string or empty array as appropriate. """, 'driver_license', ai.driverId); //egypt }, child: Column( children: [ Image.network( '${AppLink.server}/card_image/driver_license-${ai.driverId}.jpg', height: Get.height * .25, width: double.maxFinite, fit: BoxFit.fitHeight, ), Text( 'Capture an Image of Your Driver License'.tr, style: AppStyle.title, ), ], ), ), ); }, ); } GetBuilder egyptDriverIDBack() { return GetBuilder( builder: (ai) { if (ai.responseIdEgyptBack.isNotEmpty) { final taxExpiryDate = ai.responseIdEgyptBack['expirationDate']; // Check if the tax expiry date is before today final today = DateTime.now(); // Try parsing the tax expiry date. If it fails, set it to null. final taxExpiryDateTime = DateTime.tryParse(taxExpiryDate); final isExpired = taxExpiryDateTime != null && taxExpiryDateTime.isBefore(today); 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('ID Documents Back'.tr, style: AppStyle.headTitle2), IconButton( onPressed: () async { await ai.allMethodForAI(""" Write a JSON from the following information extracted from the provided Arabic text: - nationalID(in Latin numerals) - issueDate (in format YYYY-MM-DD using Latin numerals) - occupation - gender - religion - maritalStatus - fullNameMarital (if maritalStatus is "أعزب", set this to "none") - expirationDate (in format YYYY-MM-DD using Latin numerals) Please ensure all date fields use Latin (Western) numerals (0-9) instead of Arabic numerals. For example, use "2023-04-03" instead of "٢٠٢٣-٠٤-٠٣". """, 'id_back', ai.driverId); //egypt }, icon: const Icon(Icons.refresh), ), ], ), const SizedBox(height: 8.0), const Divider(color: AppColor.accentColor), const SizedBox(height: 8.0), // Assuming these keys exist in ai.responseIdEgyptFront Text( '${'National ID'.tr}: ${ai.responseIdEgyptBack['nationalID']}', style: AppStyle.title.copyWith( color: ai.responseIdEgyptDriverLicense[ 'national_number'] == ai.responseIdEgyptBack['nationalID'] ? AppColor.greenColor : AppColor.redColor), ), const SizedBox(height: 8.0), Text( '${'Occupation'.tr}: ${ai.responseIdEgyptBack['occupation']}', // Assuming 'occupation' exists ), const SizedBox(height: 8.0), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( '${'Issue Date'.tr}: ${ai.responseIdEgyptBack['issueDate']}', // Assuming 'issueDate' exists ), Text( '${'Gender'.tr}: ${ai.responseIdEgyptBack['gender']}', // Assuming 'gender' exists ), ], ), const SizedBox(height: 8.0), // Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, // children: [ // Text( // '${'Religion'.tr}: ${ai.responseIdEgyptBack['religion']}', // Assuming 'religion' exists // ), // Text( // '${'Marital Status'.tr}: ${ai.responseIdEgyptBack['maritalStatus']}', // Assuming 'maritalStatus' exists // ), // ], // ), // const SizedBox(height: 8.0), // Text( // '${'Full Name (Marital)'.tr}: ${ai.responseIdEgyptBack['fullNameMaritial']}', // Assuming 'fullNameMaritial' exists // ), // const SizedBox(height: 8.0), Text( '${'Expiration Date'.tr}: ${ai.responseIdEgyptBack['expirationDate']}', // Assuming 'expirationDate' exists style: AppStyle.title.copyWith( color: !isExpired ? AppColor.greenColor : AppColor.redColor), ), ], ), ), ); } return Card( child: InkWell( onTap: () async { await ai.allMethodForAI(''' Write a JSON object from the following information extracted from the provided Arabic text: { "nationalID": "",//(in Latin numerals) "issueDate": "", // Format: YYYY-MM-DD using Latin numerals (0-9) "occupation": "", "gender": "", "religion": "", "maritalStatus": "", "fullNameMaritial": "", // Set to "none" if maritalStatus is "أعزب" "expirationDate": "" // Format: YYYY-MM-DD using Latin numerals (0-9) } Important notes: 1. Ensure all dates (issueDate and expirationDate) are in the format YYYY-MM-DD using Latin (Western) numerals (0-9), not Arabic numerals. 2. If maritalStatus is "أعزب" (single), set fullNameMaritial to "none". 3. Fill in all fields based on the information provided in the Arabic text. 4. If any information is missing, leave the field as an empty string. ''', 'id_back', ai.driverId); //egypt }, child: Column( children: [ Image.network( '${AppLink.server}/card_image/id_back-${ai.driverId}.jpg', height: Get.height * .25, width: double.maxFinite, fit: BoxFit.fitHeight, ), Text( 'Capture an Image of Your ID Document Back'.tr, style: AppStyle.title, ), ], ), ), ); }, ); } GetBuilder egyptDriverIDFront() { return GetBuilder( builder: (ai) { if (ai.responseIdEgyptFront.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('ID Documents Front'.tr, style: AppStyle.headTitle2), IconButton( onPressed: () async { await ai.allMethodForAI(''' Write a JSON object from the following information extracted from the provided Arabic text: { "first_name": "", // The word next to "بطاقة تحقيق الشخصية" (National Identification Card) "full_name": "", // The full name on the next line after the first name "address": "", // The complete address spanning the next two lines "national_number": "", // The National ID number before the last line (convert Arabic numerals to Latin) "card_id": "", // The card ID in English on the last line "dob": "" // Year of birth only, in Latin numerals (YYYY format) } Important notes: 1. For 'first_name', extract the word immediately following "بطاقة تحقيق الشخصية". 2. 'full_name' should be the complete name found on the line after the first name. 3. 'address' should combine information from two consecutive lines. 4. Convert the 'national_number' from Arabic numerals to Latin numerals (0-9). 5. 'card_id' should be extracted as-is from the last line (it's already in English). 6. For 'dob', include only the year of birth in YYYY format using Latin numerals. 7. If any information is missing, leave the field as an empty string. ''', 'id_front', ai.driverId); //egypt }, icon: const Icon(Icons.refresh), ), ], ), const SizedBox(height: 8.0), const Divider(color: AppColor.accentColor), const SizedBox(height: 8.0), // Removed Make, Model, etc. as they are not available Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( '${'First Name'.tr}: ${ai.responseIdEgyptFront['first_name']}', ), Text( '${'CardID'.tr}: ${ai.responseIdEgyptFront['card_id']}', ), ], ), const SizedBox(height: 8.0), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( '${'Full Name'.tr}: ${ai.responseIdEgyptFront['full_name']}', ), Text( '${'DOB'.tr}: ${ai.responseIdEgyptFront['dob']}', ), ], ), const SizedBox(height: 8.0), Text( '${'Address'.tr}: ${ai.responseIdEgyptFront['address']}', ), const SizedBox(height: 8.0), // Text( // '${'National Number'.tr}: ${ai.responseIdEgyptFront['national_number']}', // ), // const SizedBox(height: 8.0), // Removed Inspection Date as it's not available ], ), ), ); } return Card( child: InkWell( onTap: () async { await ai.allMethodForAI("""" Write a JSON object from the following information extracted from the provided Arabic text: { "first_name": "", // The word next to "بطاقة تحقيق الشخصية" (National Identification Card) "full_name": "", // The full name on the next line after the first name "address": "", // The complete address spanning the next two lines "national_number": "", // The National ID number before the last line (convert Arabic numerals to Latin) "card_id": "", // The card ID in English on the last line "dob": "" // Year of birth only, in Latin numerals (YYYY format) } Important notes: 1. For 'first_name', extract the word immediately following "بطاقة تحقيق الشخصية". 2. 'full_name' should be the complete name found on the line after the first name. 3. 'address' should combine information from two consecutive lines. 4. Convert the 'national_number' from Arabic numerals to Latin numerals (0-9). 5. 'card_id' should be extracted as-is from the last line (it's already in English). 6. For 'dob', include only the year of birth in YYYY format using Latin numerals. 7. If any information is missing, leave the field as an empty string. """, 'id_front', ai.driverId); //egypt }, child: Column( children: [ Image.network( '${AppLink.server}/card_image/id_front-${ai.driverId}.png', height: Get.height * .25, width: double.maxFinite, fit: BoxFit.fitHeight, ), Text( 'Capture an Image of Your ID Document front'.tr, style: AppStyle.title, ), ], ), ), ); }, ); } GetBuilder egyptCarLicenceFront() { return GetBuilder( builder: (ai) { if (ai.responseIdCardDriverEgyptFront.isNotEmpty) { // No need to access ai.responseIdCardDriverEgyptBack anymore final licenseExpiryDate = DateTime.parse( ai.responseIdCardDriverEgyptFront['LicenseExpirationDate']); // Check if license has expired final today = DateTime.now(); final isLicenseExpired = licenseExpiryDate.isBefore(today); 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( children: [ Text('Vehicle Details Front'.tr, style: AppStyle.headTitle2), IconButton( onPressed: () async { ai.allMethodForAI(""" Extract the following details from the provided car license data and format them into a JSON object: License Expiration Date Car Plate Owner Address Car License Data: JSON Format: { "LicenseExpirationDate": "YYYY-MM-DD", "car_plate": "[Car plate number]",//the car plate is line next to line contain 'ادارة مرور' for bot numbers and letters in arabic with partition like| but you remove | "owner": "[Owner's full name]", "address": "[Address if available, otherwise 'Not provided']" } Important notes: 1. For the LicenseExpirationDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9). 2. Replace all occurrences of '|' (pipe character) with a space in all fields. 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. Please fill in the JSON object with the extracted information, following these guidelines. """, 'car_front', ai.driverId); }, icon: const Icon(Icons.refresh), ), ], ), const SizedBox(height: 8.0), const Divider(color: AppColor.accentColor), const SizedBox(height: 8.0), // Removed Make, Model, etc. as they are not available Text( '${'Plate Number'.tr}: ${ai.responseIdCardDriverEgyptFront['car_plate']}', ), const SizedBox(height: 8.0), Text( '${'Owner Name'.tr}: ${ai.responseIdCardDriverEgyptFront['owner']}', ), const SizedBox(height: 8.0), Text( '${'Address'.tr}: ${ai.responseIdCardDriverEgyptFront['address']}', ), const SizedBox(height: 8.0), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( '${'License Expiry Date'.tr}: ${licenseExpiryDate.toString().substring(0, 10)}', style: TextStyle( color: isLicenseExpired ? Colors.red : Colors.green, ), ), // Removed Fuel as it's not available ], ), // Removed Inspection Date as it's not available ], ), ), ); } return Card( child: InkWell( onTap: () async { ai.allMethodForAI(""" Extract the following details from the provided car license data and format them into a JSON object: License Expiration Date Car Plate Owner Address Car License Data: JSON Format: { "LicenseExpirationDate": "YYYY-MM-DD", "car_plate": "[Car plate number]",//the car plate is line next to line contain 'ادارة مرور' for bot numbers and letters in arabic with partition like| but you remove | "owner": "[Owner's full name]", "address": "[Address if available, otherwise 'Not provided']" } Important notes: 1. For the LicenseExpirationDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9). 2. Replace all occurrences of '|' (pipe character) with a space in all fields. 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. Please fill in the JSON object with the extracted information, following these guidelines. """, 'car_front', ai.driverId); }, child: Column( children: [ Image.network( '${AppLink.server}/card_image/car_front-${ai.driverId}.jpg', height: Get.height * .25, width: double.maxFinite, fit: BoxFit.fitHeight, ), Text( 'Capture an Image of Your car license front '.tr, style: AppStyle.title, ), ], ), ), ); }, ); } GetBuilder egyptCarLicenceBack() { return GetBuilder( builder: (ai) { if (ai.responseIdCardDriverEgyptBack.isNotEmpty) { // Get the tax expiry date from the response final taxExpiryDate = ai.responseIdCardDriverEgyptBack['tax_expiry']; // final displacement = ai.responseIdCardDriverEgyptBack['displacement']; // if (int.parse(displacement) < 1000) {} // Get the inspection date from the response final inspectionDate = ai.responseIdCardDriverEgyptBack['inspection_date']; final year = int.parse(inspectionDate.split('-')[0]); // Set inspectionDateTime to December 31st of the given year final inspectionDateTime = DateTime(year, 12, 31); String carBackLicenseExpired = inspectionDateTime.toString().split(' ')[0]; // Get the current date final today = DateTime.now(); // Try parsing the tax expiry date. If it fails, set it to null. final taxExpiryDateTime = DateTime.tryParse(taxExpiryDate ?? ''); final isExpired = taxExpiryDateTime != null && taxExpiryDateTime.isBefore(today); // Check if the inspection date is before today bool isInspectionExpired = inspectionDateTime.isBefore(today); 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('Vehicle Details Back'.tr, style: AppStyle.headTitle2), IconButton( onPressed: () async { ai.allMethodForAI(""" Analyze the extracted car license information and create a JSON object with the following keys: { "make": "", "year": "", "chassis": "", "model": "", "engine": "", "displacement": "", "cylinders": "", "fuel": "", "color": "", "color_hex": "", "inspection_date": "", "assuranceNumber": "", "tax_expiry": "" } Important notes: 1. For dates (inspection_date and tax_expiry), use the format YYYY-MM-DD with Latin numerals (0-9). 2. Convert the color name to its corresponding hex color code for the 'color_hex' field. 3. Ensure all numeric values (year, displacement, cylinders) are in Latin numerals. 4. If any information is missing, leave the corresponding field as an empty string. 5. Do not include any explanatory text in the JSON fields, only the extracted values. displacement in the line contain (سم٣ ) Please fill in the JSON object with the extracted information, following these guidelines. """, 'car_back', ai.driverId); }, icon: const Icon(Icons.refresh), ), ], ), const SizedBox(height: 8.0), const Divider(color: AppColor.accentColor), const SizedBox(height: 8.0), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( '${'Make'.tr}: ${ai.responseIdCardDriverEgyptBack['make']}'), Text( '${'Model'.tr}: ${ai.responseIdCardDriverEgyptBack['model']}'), ], ), const SizedBox(height: 8.0), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( '${'Year'.tr}: ${ai.responseIdCardDriverEgyptBack['year']}'), Text( '${'Chassis'.tr}: ${ai.responseIdCardDriverEgyptBack['chassis']}'), ], ), const SizedBox(height: 8.0), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( '${'Color'.tr}: ${ai.responseIdCardDriverEgyptBack['color']}'), Text( '${'Displacement'.tr}: ${ai.responseIdCardDriverEgyptBack['displacement']} cc'), ], ), const SizedBox(height: 8.0), Text( '${'Fuel'.tr}: ${ai.responseIdCardDriverEgyptBack['fuel']}'), const SizedBox(height: 8.0), if (taxExpiryDateTime != null) Text( '${'Tax Expiry Date'.tr}: $taxExpiryDate', style: TextStyle( color: isExpired ? Colors.red : Colors.green, ), ), const SizedBox(height: 8.0), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( '${'Inspection Date'.tr}: $carBackLicenseExpired', style: TextStyle( color: isInspectionExpired ? Colors.red : Colors.green, ), ), ], ), ], ), ), ); } return Card( child: InkWell( onTap: () async { ai.allMethodForAI(""" Analyze the extracted car license information and create a JSON object with the following keys: { "make": "", "year": "", "chassis": "", "model": "", "engine": "", "displacement": "", "cylinders": "", "fuel": "", "color": "", "color_hex": "", "inspection_date": "", "assuranceNumber": "", "tax_expiry": "" } Important notes: 1. For dates (inspection_date and tax_expiry), use the format YYYY-MM-DD with Latin numerals (0-9). 2. Convert the color name to its corresponding hex color code for the 'color_hex' field. 3. Ensure all numeric values (year, displacement, cylinders) are in Latin numerals. 4. If any information is missing, leave the corresponding field as an empty string. 5. Do not include any explanatory text in the JSON fields, only the extracted values. Please fill in the JSON object with the extracted information, following these guidelines. """, 'car_back', ai.driverId); }, child: Column( children: [ Image.network( '${AppLink.server}/card_image/car_back-${ai.driverId}.jpg', height: Get.height * .25, width: double.maxFinite, fit: BoxFit.fitHeight, ), Text( 'Capture an Image of Your car license back'.tr, style: AppStyle.title, ), ], ), ), ); }, ); } GetBuilder egyptCriminalRecord() { return GetBuilder( 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. """, 'criminalRecord', ai.driverId); }, 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. """, 'criminalRecord', ai.driverId); }, child: Column( children: [ Image.network( '${AppLink.server}/card_image/6.png', height: Get.height * .25, width: double.maxFinite, fit: BoxFit.fitHeight, ), Text( 'Capture an Image of Your Criminal Record'.tr, style: AppStyle.title, ), ], ), ), ); }, ); } }