This commit is contained in:
Hamza-Ayed
2023-12-03 10:35:27 +03:00
parent e095cf564a
commit 2501292424
50 changed files with 1841 additions and 730 deletions

View File

@@ -1,8 +1,12 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/colors.dart';
import 'package:ride/constant/links.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/constant/table_names.dart';
import 'package:ride/controller/auth/captin/register_captin_controller.dart';
import 'package:ride/controller/functions/ocr_controller.dart';
import 'package:ride/main.dart';
import 'package:ride/views/auth/captin/car_license_page.dart';
@@ -12,8 +16,9 @@ import 'package:ride/views/widgets/mycircular.dart';
class AiPage extends StatelessWidget {
ScanDocumentsByApi scanDocumentsByApi = Get.put(ScanDocumentsByApi());
RegisterCaptainController registerCaptainController =
Get.put(RegisterCaptainController());
AiPage({super.key});
@override
Widget build(BuildContext context) {
return MyScafolld(
@@ -198,8 +203,14 @@ class AiPage extends StatelessWidget {
.toString() ==
'Same'
? MyElevatedButton(
onPressed: () =>
Get.to(() => CarLicensePage()),
onPressed: () async {
await registerCaptainController
.register();
await registerCaptainController
.addLisence();
// await scanDocumentsByApi
// .uploadImagePortrate();
},
title:
'Go to next step\nscan Car License.'
.tr,

View File

@@ -2,10 +2,8 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/api_key.dart';
import 'package:ride/env/env.dart';
import 'package:ride/controller/functions/ocr_controller.dart';
import '../../../constant/box_name.dart';
import '../../../constant/style.dart';
import '../../../controller/auth/captin/ml_google_doc.dart';
import '../../../controller/auth/captin/register_captin_controller.dart';
@@ -21,6 +19,7 @@ class CarLicensePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
Get.find<ScanDocumentsByApi>().uploadImagePortrate();
return MyScafolld(
title: 'Car License Card'.tr,
body: [
@@ -42,19 +41,20 @@ class CarLicensePage extends StatelessWidget {
Positioned(
top: 50,
child: SizedBox(
height: Get.height * .7,
height: Get.height * .6,
width: Get.width,
child: buildImageWithBoundingBoxes(),
),
),
Positioned(
bottom: 20,
bottom: Get.height * .2,
left: Get.width * .2,
right: Get.width * .2,
child: MyElevatedButton(
title: 'Register'.tr,
onPressed: () async {
registerCaptainController.addLisence();
// registerCaptainController.addLisence();
// registerCaptainController.register();
registerCaptainController.addRegisrationCarForDriver(
carRegistrationRecognizerController.extracted['vin'],
carRegistrationRecognizerController.extracted['make'],
@@ -67,7 +67,6 @@ class CarLicensePage extends StatelessWidget {
carRegistrationRecognizerController
.extracted['registration_date'],
);
registerCaptainController.register();
},
)),
],

View File

@@ -148,10 +148,13 @@ class LoginCaptin extends StatelessWidget {
'Please enter your phone number.'.tr,
),
validator: (value) {
if (value!.isEmpty ||
(value.length > 6)) {
if (value!.isEmpty) {
return 'Please enter Your Password.'.tr;
}
if (value.length < 6) {
return 'Password must br at least 6 character.'
.tr;
}
return null;
},
),
@@ -261,88 +264,91 @@ class LoginCaptin extends StatelessWidget {
Padding agreedPage() {
return Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.asset(
'assets/images/notepad.png',
width: Get.width * .2,
),
SizedBox(
width: Get.width * .7,
child: Text(
'Accept Ride\'s Terms & Review Privacy Notice'.tr,
style: AppStyle.headtitle2,
),
),
],
),
const SizedBox(
height: 30,
),
RichText(
text: TextSpan(
text:
'By selecting "I Agree" below, I have reviewed and agree to the Terms of Use and acknowledge the ',
style: AppStyle.title,
children: <TextSpan>[
TextSpan(
text: 'Privacy Notice',
style: const TextStyle(
decoration: TextDecoration.underline,
color: AppColor.blueColor),
recognizer: TapGestureRecognizer()
..onTap = () {
Get.defaultDialog(
title: ''.tr,
content: const SizedBox(
height: 400,
width: 400,
child: SingleChildScrollView(
child: HtmlWidget(AppInformation.privacyPolicy),
),
));
}),
const TextSpan(
text: '. I am at least 18 years of age.',
),
],
),
),
const SizedBox(
height: 100,
),
GetBuilder<LoginController>(
builder: (controller) => Column(
child: SingleChildScrollView(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Checkbox.adaptive(
autofocus: true,
tristate: true,
splashRadius: 25,
activeColor: AppColor.primaryColor,
value: controller.isAgreeTerms,
onChanged: (value) => controller.changeAgreeTerm(),
),
Text(
'I Agree'.tr,
style: controller.isAgreeTerms
? AppStyle.title
: AppStyle.title
.copyWith(color: AppColor.accentColor),
),
],
Image.asset(
'assets/images/notepad.png',
width: Get.width * .2,
),
SizedBox(
width: Get.width * .7,
child: Text(
'Accept Ride\'s Terms & Review Privacy Notice'.tr,
style: AppStyle.headtitle2,
),
),
MyElevatedButton(
title: 'Submit'.tr,
onPressed: () => controller.saveAgreementTerms()),
],
),
)
],
const SizedBox(
height: 30,
),
RichText(
text: TextSpan(
text:
'By selecting "I Agree" below, I have reviewed and agree to the Terms of Use and acknowledge the ',
style: AppStyle.title,
children: <TextSpan>[
TextSpan(
text: 'Privacy Notice',
style: const TextStyle(
decoration: TextDecoration.underline,
color: AppColor.blueColor),
recognizer: TapGestureRecognizer()
..onTap = () {
Get.defaultDialog(
title: ''.tr,
content: const SizedBox(
height: 400,
width: 400,
child: SingleChildScrollView(
child:
HtmlWidget(AppInformation.privacyPolicy),
),
));
}),
const TextSpan(
text: '. I am at least 18 years of age.',
),
],
),
),
const SizedBox(
height: 100,
),
GetBuilder<LoginController>(
builder: (controller) => Column(
children: [
Row(
children: [
Checkbox.adaptive(
autofocus: true,
tristate: true,
splashRadius: 25,
activeColor: AppColor.primaryColor,
value: controller.isAgreeTerms,
onChanged: (value) => controller.changeAgreeTerm(),
),
Text(
'I Agree'.tr,
style: controller.isAgreeTerms
? AppStyle.title
: AppStyle.title
.copyWith(color: AppColor.accentColor),
),
],
),
MyElevatedButton(
title: 'Submit'.tr,
onPressed: () => controller.saveAgreementTerms()),
],
),
)
],
),
),
);
}

View File

@@ -250,11 +250,11 @@ class RegisterCaptin extends StatelessWidget {
MyElevatedButton(
title: 'Next'.tr,
onPressed: () => controller.nextToAIDetection()),
MyElevatedButton(
//todo remove it for test
title: 'Car registration ai '.tr,
kolor: AppColor.blueColor,
onPressed: () => Get.to(() => CarLicensePage())),
// MyElevatedButton(
// //todo remove it for test
// title: 'Car registration ai '.tr,
// kolor: AppColor.blueColor,
// onPressed: () => Get.to(() => CarLicensePage())),
// controller.isloading
// ? const MyCircularProgressIndicator()