11/1/9
This commit is contained in:
257
lib/views/auth/captin/ai_page.dart
Normal file
257
lib/views/auth/captin/ai_page.dart
Normal file
@@ -0,0 +1,257 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/constant/table_names.dart';
|
||||
import 'package:ride/controller/functions/ocr_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/auth/captin/car_license_page.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
import 'package:ride/views/widgets/my_scafold.dart';
|
||||
import 'package:ride/views/widgets/mycircular.dart';
|
||||
|
||||
class AiPage extends StatelessWidget {
|
||||
ScanDocumentsByApi scanDocumentsByApi = Get.put(ScanDocumentsByApi());
|
||||
|
||||
AiPage({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MyScafolld(
|
||||
title: 'AI Page'.tr,
|
||||
body: [
|
||||
Positioned(
|
||||
top: 3,
|
||||
left: Get.width * .2,
|
||||
right: Get.width * .2,
|
||||
child: MyElevatedButton(
|
||||
title: 'Take Picture Of ID Card'.tr,
|
||||
onPressed: () {
|
||||
scanDocumentsByApi.scanDocumentsByApi();
|
||||
},
|
||||
)),
|
||||
GetBuilder<ScanDocumentsByApi>(
|
||||
builder: (scanDocumentsByApi) => scanDocumentsByApi
|
||||
.responseMap.isNotEmpty
|
||||
? Positioned(
|
||||
top: Get.height * .06,
|
||||
left: Get.width * .051,
|
||||
right: Get.width * .051,
|
||||
child: scanDocumentsByApi.isLoading
|
||||
? Column(
|
||||
children: [
|
||||
const MyCircularProgressIndicator(),
|
||||
Text(
|
||||
'We are process picture please wait '.tr,
|
||||
style: AppStyle.title,
|
||||
)
|
||||
],
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: Get.height * .35,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5),
|
||||
child: scanDocumentsByApi.responseMap.isEmpty
|
||||
? Center(
|
||||
child: Text(
|
||||
'There is no data yet.'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Name :${scanDocumentsByApi.responseMap['data']['ocr']['name'].toString()}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Drivers License Class: ${scanDocumentsByApi.responseMap['data']['ocr']['dlClass'].toString()}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Image.memory(
|
||||
scanDocumentsByApi
|
||||
.imageSignature,
|
||||
width: 100,
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Document Number: ${scanDocumentsByApi.responseMap['data']['ocr']['documentNumber'].toString()}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Image.memory(
|
||||
scanDocumentsByApi
|
||||
.imagePortrait,
|
||||
width: 60,
|
||||
),
|
||||
]),
|
||||
Text(
|
||||
'Address: ${scanDocumentsByApi.responseMap['data']['ocr']['address'].toString()}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Height: ${scanDocumentsByApi.responseMap['data']['ocr']['height'].toString()}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
'Postal Code: ${scanDocumentsByApi.responseMap['data']['ocr']['addressPostalCode'].toString()}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
'Sex: ${scanDocumentsByApi.responseMap['data']['ocr']['sex'].toString()}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
'Jurisdiction Code: ${scanDocumentsByApi.responseMap['data']['ocr']['addressJurisdictionCode'].toString()}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Expiry Date: ${scanDocumentsByApi.responseMap['data']['ocr']['dateOfExpiry'].toString()}',
|
||||
style: DateTime.parse(
|
||||
scanDocumentsByApi
|
||||
.responseMap['data']
|
||||
['ocr'][
|
||||
'dateOfExpiry']
|
||||
.toString())
|
||||
.isBefore(
|
||||
scanDocumentsByApi
|
||||
.now)
|
||||
? AppStyle.title.copyWith(
|
||||
color:
|
||||
AppColor.redColor)
|
||||
: AppStyle.title.copyWith(
|
||||
color: AppColor
|
||||
.greenColor),
|
||||
),
|
||||
Text(
|
||||
'Date of Birth: ${scanDocumentsByApi.responseMap['data']['ocr']['dateOfBirth'].toString()}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
DateTime.parse(scanDocumentsByApi
|
||||
.responseMap['data']['ocr']
|
||||
['dateOfExpiry']
|
||||
.toString())
|
||||
.isBefore(scanDocumentsByApi.now)
|
||||
? Text(
|
||||
'You can\'t continue with us .\nYou should renew Driver license',
|
||||
style: AppStyle.title
|
||||
.copyWith(color: AppColor.redColor),
|
||||
)
|
||||
: MyElevatedButton(
|
||||
title: 'Detect Your Face '.tr,
|
||||
onPressed: () => scanDocumentsByApi
|
||||
.checkMatchFaceApi(),
|
||||
),
|
||||
scanDocumentsByApi.res.isEmpty
|
||||
? const SizedBox()
|
||||
: scanDocumentsByApi.res['data']['result']
|
||||
.toString() ==
|
||||
'Same'
|
||||
? MyElevatedButton(
|
||||
onPressed: () =>
|
||||
Get.to(() => CarLicensePage()),
|
||||
title:
|
||||
'Go to next step\nscan Car License.'
|
||||
.tr,
|
||||
kolor: AppColor.greenColor,
|
||||
)
|
||||
: const SizedBox(),
|
||||
MyElevatedButton(
|
||||
title: 'title',
|
||||
onPressed: () {
|
||||
// sql.deleteAllData(TableName.faceDetectTimes);
|
||||
sql
|
||||
.getAllData(TableName.faceDetectTimes)
|
||||
.then((value) =>
|
||||
print(value[0]['faceDetectTimes']));
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
: Positioned(
|
||||
top: Get.height * .06,
|
||||
left: Get.width * .051,
|
||||
right: Get.width * .051,
|
||||
child: scanDocumentsByApi.isLoading
|
||||
? Column(
|
||||
children: [
|
||||
const MyCircularProgressIndicator(),
|
||||
Text(
|
||||
'We are process picture please wait '.tr,
|
||||
style: AppStyle.title,
|
||||
)
|
||||
],
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: Get.height * .35,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'There is no data yet.'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
isleading: true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user