11/1/6
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -3,12 +3,9 @@ import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/auth/login_page.dart';
|
||||
import 'package:ride/views/home/home_page.dart';
|
||||
|
||||
import '../../models/model/onboarding_model.dart';
|
||||
|
||||
class OnboardingController extends GetxController {}
|
||||
|
||||
abstract class OnBoardingController extends GetxController {
|
||||
next();
|
||||
onPageChanged(int index);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter_tesseract_ocr/flutter_tesseract_ocr.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_tesseract_ocr/android_ios.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_mlkit_text_recognition/google_mlkit_text_recognition.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
@@ -44,11 +47,11 @@ class TextExtractionController extends GetxController {
|
||||
|
||||
Future<void> pickAndExtractText() async {
|
||||
final pickedImage = await ImagePicker().pickImage(
|
||||
source: ImageSource.gallery,
|
||||
// preferredCameraDevice: CameraDevice.rear,
|
||||
// maxHeight: Get.height * .7,
|
||||
// maxWidth: Get.width * .9,
|
||||
// imageQuality: 99,
|
||||
source: ImageSource.camera,
|
||||
preferredCameraDevice: CameraDevice.rear,
|
||||
maxHeight: Get.height * .3,
|
||||
maxWidth: Get.width * .8,
|
||||
imageQuality: 99,
|
||||
);
|
||||
if (pickedImage != null) {
|
||||
isloading = true;
|
||||
@@ -103,13 +106,142 @@ class TextMLGoogleRecognizerController extends GetxController {
|
||||
|
||||
// The scanned text
|
||||
String? scannedText;
|
||||
String? jsonOutput;
|
||||
final List<Map<String, dynamic>> lines = [];
|
||||
|
||||
Map decode = {};
|
||||
|
||||
Future<void> scanText() async {
|
||||
// Pick an image from the camera or gallery
|
||||
final XFile? image =
|
||||
await _imagePicker.pickImage(source: ImageSource.gallery);
|
||||
|
||||
// If no image was picked, return
|
||||
if (image == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert the XFile object to an InputImage object
|
||||
final InputImage inputImage = InputImage.fromFile(File(image.path));
|
||||
|
||||
// Recognize the text in the image
|
||||
final RecognizedText recognizedText =
|
||||
await _textRecognizer.processImage(inputImage);
|
||||
scannedText = recognizedText.text;
|
||||
Map extractedData = {};
|
||||
// Extract the scanned text line by line
|
||||
for (var i = 0; i < recognizedText.blocks.length; i++) {
|
||||
final block = recognizedText.blocks[i];
|
||||
for (final line in block.lines) {
|
||||
final lineText = line.text;
|
||||
|
||||
if (lineText.contains('DL')) {
|
||||
final dlNumber = lineText.split('DL')[1].trim();
|
||||
extractedData['dl_number'] = dlNumber;
|
||||
}
|
||||
if (lineText.contains('USA')) {
|
||||
final usa = lineText.split('USA')[1].trim();
|
||||
extractedData['USA'] = usa;
|
||||
}
|
||||
if (lineText.contains('DRIVER LICENSE')) {
|
||||
final driverl = lineText;
|
||||
extractedData['DRIVER_LICENSE'] = driverl;
|
||||
}
|
||||
|
||||
if (lineText.contains('EXP')) {
|
||||
final expiryDate = lineText.split('EXP')[1].trim();
|
||||
extractedData['expiry_date'] = expiryDate;
|
||||
}
|
||||
|
||||
if (lineText.contains('DOB')) {
|
||||
final dob = lineText.split('DOB')[1].trim();
|
||||
extractedData['dob'] = dob;
|
||||
}
|
||||
|
||||
if (lineText.contains("LN")) {
|
||||
if ((lineText.indexOf("LN") == 0)) {
|
||||
final lastName = lineText.split('LN')[1].trim();
|
||||
extractedData['lastName'] = lastName;
|
||||
}
|
||||
}
|
||||
if (lineText.contains("FN")) {
|
||||
final firstName = lineText.split('FN')[1].trim();
|
||||
extractedData['firstName'] = firstName;
|
||||
}
|
||||
if (lineText.contains("RSTR")) {
|
||||
final rstr = lineText.split('RSTR')[1].trim();
|
||||
extractedData['rstr'] = rstr;
|
||||
}
|
||||
if (lineText.contains("CLASS")) {
|
||||
final class1 = lineText.split('CLASS')[1].trim();
|
||||
extractedData['class'] = class1;
|
||||
}
|
||||
if (lineText.contains("END")) {
|
||||
final end = lineText.split('END')[1].trim();
|
||||
extractedData['end'] = end;
|
||||
}
|
||||
if (lineText.contains("DD")) {
|
||||
final dd = lineText.split('DD')[1].trim();
|
||||
extractedData['dd'] = dd;
|
||||
}
|
||||
if (lineText.contains("EYES")) {
|
||||
final eyes = lineText.split('EYES')[1].trim();
|
||||
extractedData['eyes'] = eyes;
|
||||
}
|
||||
if (lineText.contains("SEX")) {
|
||||
final parts = lineText.split("SEX ")[1];
|
||||
extractedData['sex'] = parts[0];
|
||||
}
|
||||
if (lineText.contains("HAIR")) {
|
||||
final hair = lineText.split('HAIR')[1].trim();
|
||||
extractedData['hair'] = hair;
|
||||
}
|
||||
|
||||
if (lineText.contains('STREET') || lineText.contains(',')) {
|
||||
final address = lineText;
|
||||
extractedData['address'] = address;
|
||||
}
|
||||
|
||||
// Repeat this process for other relevant data fields
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the list of lines to a JSON string
|
||||
jsonOutput = jsonEncode(extractedData);
|
||||
decode = jsonDecode(jsonOutput!);
|
||||
|
||||
update();
|
||||
print('jsonOutput------------------------------');
|
||||
print(scannedText);
|
||||
}
|
||||
}
|
||||
|
||||
class PassportRecognizerController extends GetxController {
|
||||
@override
|
||||
void onInit() {
|
||||
scanText();
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
// The ImagePicker instance
|
||||
final ImagePicker _imagePicker = ImagePicker();
|
||||
Map extractedData = {};
|
||||
|
||||
// The GoogleMlKit TextRecognizer instance
|
||||
final TextRecognizer _textRecognizer = TextRecognizer();
|
||||
|
||||
// The scanned text
|
||||
String? scannedText;
|
||||
String? jsonOutput;
|
||||
final List<Map<String, dynamic>> lines = [];
|
||||
|
||||
Map decode = {};
|
||||
// Picks an image from the camera or gallery and extracts the text
|
||||
|
||||
Future<void> scanText() async {
|
||||
// Pick an image from the camera or gallery
|
||||
final XFile? image =
|
||||
await _imagePicker.pickImage(source: ImageSource.camera);
|
||||
await _imagePicker.pickImage(source: ImageSource.gallery);
|
||||
|
||||
// If no image was picked, return
|
||||
if (image == null) {
|
||||
@@ -127,15 +259,181 @@ class TextMLGoogleRecognizerController extends GetxController {
|
||||
final List<Map<String, dynamic>> lines = [];
|
||||
for (var i = 0; i < recognizedText.blocks.length; i++) {
|
||||
lines.add({
|
||||
'line_number': i,
|
||||
'text': recognizedText.blocks[i].text,
|
||||
i.toString() +
|
||||
'_' +
|
||||
recognizedText.blocks[i].text.toString().split('\n')[0]:
|
||||
recognizedText.blocks[i].text,
|
||||
});
|
||||
}
|
||||
// for (var i = 0; i < recognizedText.blocks.length; i++) {
|
||||
// final block = recognizedText.blocks[i];
|
||||
for (final line in lines) {
|
||||
final key = line.keys.first;
|
||||
final value = line.values.first;
|
||||
if (line.values.contains('UNITED STATES OF')) {
|
||||
final title = line;
|
||||
extractedData['title'] = title;
|
||||
}
|
||||
if (line.values.contains('PASSPORT CARD')) {
|
||||
final passport = line;
|
||||
extractedData['passport'] = passport;
|
||||
}
|
||||
if (key == "7_Surname") {
|
||||
final nextItem = lines[lines.indexOf(line) + 1];
|
||||
extractedData['surname'] = nextItem.values.first;
|
||||
}
|
||||
if (key == "6_Nationality") {
|
||||
var nationality = value.split('\n')[1];
|
||||
extractedData['nationality'] = nationality;
|
||||
}
|
||||
if (key.contains('CARD')) {
|
||||
var passportCard = value;
|
||||
extractedData['passportCard'] = passportCard;
|
||||
}
|
||||
if (key.contains("9_Given")) {
|
||||
var givenNames = value.split('\n')[1];
|
||||
extractedData['givenNames'] = givenNames;
|
||||
}
|
||||
if (key.contains("13_Date of Birth")) {
|
||||
final parts = value.split('\n');
|
||||
if (parts.length > 1) {
|
||||
var dateOfBirth = parts[1];
|
||||
extractedData['dateOfBirth'] = dateOfBirth;
|
||||
|
||||
var sex = parts[0].split(' ')[1];
|
||||
extractedData['sex'] = sex;
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
// Convert the list of lines to a JSON string
|
||||
final String jsonOutput = jsonEncode(lines);
|
||||
jsonOutput = jsonEncode(extractedData);
|
||||
decode = jsonDecode(jsonOutput!);
|
||||
|
||||
update();
|
||||
// Print the JSON output
|
||||
print(jsonOutput);
|
||||
print('jsonOutput------------------------------');
|
||||
print(decode);
|
||||
// print(jsonEncode(lines));
|
||||
}
|
||||
}
|
||||
|
||||
class PassportDataExtractor extends GetxController {
|
||||
@override
|
||||
void onInit() {
|
||||
extractPassportData();
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
final ImagePicker _imagePicker = ImagePicker();
|
||||
late final XFile? image;
|
||||
final TextRecognizer _textRecognizer = TextRecognizer();
|
||||
|
||||
Future<Map<String, dynamic>> extractPassportData() async {
|
||||
image = await _imagePicker.pickImage(source: ImageSource.gallery);
|
||||
update();
|
||||
if (image == null) {
|
||||
throw Exception('No image picked');
|
||||
}
|
||||
|
||||
final InputImage inputImage = InputImage.fromFile(File(image!.path));
|
||||
final RecognizedText recognisedText =
|
||||
await _textRecognizer.processImage(inputImage);
|
||||
|
||||
final Map<String, dynamic> extractedData = {};
|
||||
final List<Map<String, dynamic>> extractedTextWithCoordinates = [];
|
||||
|
||||
for (TextBlock block in recognisedText.blocks) {
|
||||
for (TextLine line in block.lines) {
|
||||
final String lineText = line.text;
|
||||
final Rect lineBoundingBox = line.boundingBox!;
|
||||
|
||||
extractedTextWithCoordinates.add({
|
||||
'text': lineText,
|
||||
'boundingBox': {
|
||||
'left': lineBoundingBox.left,
|
||||
'top': lineBoundingBox.top,
|
||||
'width': lineBoundingBox.width,
|
||||
'height': lineBoundingBox.height,
|
||||
},
|
||||
});
|
||||
|
||||
// if (lineText.contains('Passport Number')) {
|
||||
// final String passportNumber =
|
||||
// lineText.split('Passport Number')[1].trim();
|
||||
// extractedData['passportNumber'] = passportNumber;
|
||||
// }
|
||||
// if (lineText.contains('Given Names')) {
|
||||
// final String givenNames = lineText.split('Given Names')[1].trim();
|
||||
// extractedData['givenNames'] = givenNames;
|
||||
// }
|
||||
// if (lineText.contains('Surname')) {
|
||||
// final String surname = lineText.split('Surname')[1].trim();
|
||||
// extractedData['surname'] = surname;
|
||||
// }
|
||||
// if (lineText.contains('Nationality')) {
|
||||
// final String nationality = lineText.split('Nationality')[1].trim();
|
||||
// extractedData['nationality'] = nationality;
|
||||
// }
|
||||
// if (lineText.contains('Date of Birth')) {
|
||||
// final String dob = lineText.split('Date of Birth')[1].trim();
|
||||
// extractedData['dateOfBirth'] = dob;
|
||||
// }
|
||||
// Add more field extraction conditions as needed
|
||||
}
|
||||
}
|
||||
|
||||
extractedData['extractedTextWithCoordinates'] =
|
||||
extractedTextWithCoordinates;
|
||||
print(jsonEncode(extractedData));
|
||||
return extractedData;
|
||||
}
|
||||
}
|
||||
|
||||
class PassportDataController extends GetxController {
|
||||
PassportDataExtractor passportDataExtractor = PassportDataExtractor();
|
||||
List<Map<String, dynamic>> extractedTextWithCoordinates = [];
|
||||
|
||||
Future<void> extractDataAndDrawBoundingBoxes() async {
|
||||
try {
|
||||
Map<String, dynamic> extractedData =
|
||||
await passportDataExtractor.extractPassportData();
|
||||
extractedTextWithCoordinates =
|
||||
extractedData['extractedTextWithCoordinates'];
|
||||
update(); // Notify GetX that the state has changed
|
||||
print(extractedTextWithCoordinates);
|
||||
} catch (e) {
|
||||
print('Passport data extraction failed: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class BoundingBoxPainter extends CustomPainter {
|
||||
final List<Map<String, dynamic>> boundingBoxes;
|
||||
|
||||
BoundingBoxPainter(this.boundingBoxes);
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final Paint paint = Paint()
|
||||
..color = Colors.red
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 2.0;
|
||||
|
||||
for (Map<String, dynamic> boundingBox in boundingBoxes) {
|
||||
double left = boundingBox['left'];
|
||||
double top = boundingBox['top'];
|
||||
double width = boundingBox['width'];
|
||||
double height = boundingBox['height'];
|
||||
|
||||
Rect rect = Rect.fromLTWH(left, top, width, height);
|
||||
canvas.drawRect(rect, paint);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant CustomPainter oldDelegate) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ class HomeCaptainController extends GetxController {
|
||||
Timer? activeTimer;
|
||||
Map data = {};
|
||||
String totalMoneyToday = '0';
|
||||
String totalMoneyInSEFER = '0';
|
||||
String totalDurationToday = '0';
|
||||
Timer? timer;
|
||||
// Inject the LocationController class
|
||||
@@ -89,7 +90,8 @@ class HomeCaptainController extends GetxController {
|
||||
link: AppLink.getDriverpaymentToday,
|
||||
payload: {'driverID': box.read(BoxName.driverID).toString()});
|
||||
data = jsonDecode(res);
|
||||
totalMoneyToday = data['message'][0]['total_amount'];
|
||||
totalMoneyToday = data['message'][0]['todayAmount'];
|
||||
totalMoneyInSEFER = data['message'][0]['total_amount'];
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ class MapPassengerController extends GetxController {
|
||||
int seconds = remainingTimeTimerRideBegin % 60;
|
||||
stringRemainingTimeRideBegin =
|
||||
'$minutes:${seconds.toString().padLeft(2, '0')}';
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -207,6 +208,10 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
print('rideTimerBegin: $rideTimerBegin');
|
||||
print('isRideFinished: $isRideFinished');
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': box.read(BoxName.passengerID).toString(),
|
||||
'balance': ((-1) * totalPassenger).toString()
|
||||
});
|
||||
Get.to(() => RateCaptainFromPassenger(), arguments: {
|
||||
'driverId': driverId.toString(),
|
||||
'rideId': rideId.toString(),
|
||||
|
||||
65
lib/controller/home/splash_screen_controlle.dart
Normal file
65
lib/controller/home/splash_screen_controlle.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/views/auth/login_page.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
import '../../onbording_page.dart';
|
||||
import '../../views/auth/captin/login_captin.dart';
|
||||
import '../../views/home/Captin/home_captin.dart';
|
||||
import '../../views/home/map_page.dart';
|
||||
|
||||
class SplashScreenController extends GetxController
|
||||
with SingleGetTickerProviderMixin {
|
||||
late AnimationController animationController;
|
||||
late Animation<double> zoomInAnimation;
|
||||
late Animation<double> zoomOutAnimation;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(seconds: 7),
|
||||
);
|
||||
|
||||
zoomInAnimation = Tween<double>(begin: 1.0, end: 1.5).animate(
|
||||
CurvedAnimation(
|
||||
parent: animationController,
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
|
||||
zoomOutAnimation = Tween<double>(begin: 1.5, end: 1.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: animationController,
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
|
||||
animationController.repeat(reverse: true);
|
||||
startTimer();
|
||||
}
|
||||
|
||||
void startTimer() {
|
||||
Timer(const Duration(seconds: 7), () {
|
||||
box.read(BoxName.onBoarding) == null
|
||||
? Get.off(() => OnBoardingPage())
|
||||
: box.read(BoxName.email) != null
|
||||
? Get.off(() => const MapPage())
|
||||
: box.read(BoxName.emailDriver) == null
|
||||
? Get.off(() => LoginPage())
|
||||
: box.read(BoxName.emailDriver) != null
|
||||
? Get.off(() => const HomeCaptain())
|
||||
: Get.off(() => LoginCaptin());
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
animationController.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -9,18 +8,14 @@ import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:ride/constant/credential.dart';
|
||||
import 'package:ride/constant/info.dart';
|
||||
import 'package:ride/views/auth/captin/login_captin.dart';
|
||||
import 'package:ride/views/auth/login_page.dart';
|
||||
import 'package:ride/views/home/Captin/home_captin.dart';
|
||||
import 'package:ride/splash_screen_page.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'constant/box_name.dart';
|
||||
import 'controller/firebase/firbase_messge.dart';
|
||||
import 'controller/local/local_controller.dart';
|
||||
import 'controller/local/translations.dart';
|
||||
import 'firebase_options.dart';
|
||||
import 'models/db_sql.dart';
|
||||
import 'onbording_page.dart';
|
||||
import 'views/home/map_page.dart';
|
||||
|
||||
final box = GetStorage();
|
||||
DbSql sql = DbSql.instance;
|
||||
@@ -55,7 +50,10 @@ void main() async {
|
||||
// cameras = await availableCameras();
|
||||
await Future.wait(initializationTasks);
|
||||
}
|
||||
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
DeviceOrientation.portraitDown,
|
||||
]);
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@@ -66,25 +64,17 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
LocaleController controller = Get.put(LocaleController());
|
||||
LocaleController localController = Get.put(LocaleController());
|
||||
|
||||
return GetMaterialApp(
|
||||
title: AppInformation.appName,
|
||||
translations: MyTranslation(),
|
||||
debugShowCheckedModeBanner: false,
|
||||
locale: controller.language,
|
||||
theme: controller.appTheme,
|
||||
key: UniqueKey(),
|
||||
// routes: {'/':const HomePage()},
|
||||
home: box.read(BoxName.onBoarding) == null
|
||||
? OnBoardingPage()
|
||||
: box.read(BoxName.email) != null
|
||||
? const MapPage()
|
||||
: box.read(BoxName.emailDriver) == null
|
||||
? LoginPage()
|
||||
: box.read(BoxName.emailDriver) != null
|
||||
? const HomeCaptain()
|
||||
: LoginCaptin(),
|
||||
);
|
||||
title: AppInformation.appName,
|
||||
translations: MyTranslation(),
|
||||
debugShowCheckedModeBanner: false,
|
||||
locale: localController.language,
|
||||
theme: localController.appTheme,
|
||||
key: UniqueKey(),
|
||||
// routes: {'/':const HomePage()},
|
||||
// home: LoginCaptin());
|
||||
home: SplashScreen());
|
||||
}
|
||||
}
|
||||
|
||||
66
lib/splash_screen_page.dart
Normal file
66
lib/splash_screen_page.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_stripe/flutter_stripe.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/info.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
|
||||
import 'controller/home/splash_screen_controlle.dart';
|
||||
|
||||
class SplashScreen extends StatelessWidget {
|
||||
final SplashScreenController splashScreenController =
|
||||
Get.put(SplashScreenController());
|
||||
|
||||
SplashScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor:
|
||||
AppColor.primaryColor, // Set your desired background color
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
GetBuilder<SplashScreenController>(
|
||||
builder: (_) {
|
||||
return AnimatedBuilder(
|
||||
animation: splashScreenController.animationController,
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return Transform.scale(
|
||||
scale:
|
||||
splashScreenController.animationController.value < 0.5
|
||||
? splashScreenController.zoomInAnimation.value
|
||||
: splashScreenController.zoomOutAnimation.value,
|
||||
child: Image.asset('assets/images/logo.png'),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
AnimatedTextKit(animatedTexts: [
|
||||
TypewriterAnimatedText(
|
||||
'Welcome to ${AppInformation.appName}',
|
||||
textStyle:
|
||||
AppStyle.headTitle.copyWith(color: AppColor.greenColor),
|
||||
speed: const Duration(milliseconds: 200),
|
||||
),
|
||||
], isRepeatingAnimation: true),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
AnimatedTextKit(animatedTexts: [
|
||||
TypewriterAnimatedText(
|
||||
'Powered By ${AppInformation.companyName}',
|
||||
textStyle:
|
||||
AppStyle.title.copyWith(color: AppColor.secondaryColor),
|
||||
speed: const Duration(milliseconds: 200),
|
||||
),
|
||||
], isRepeatingAnimation: true)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:html/parser.dart' show parse;
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/info.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/auth/captin/login_captin_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
@@ -184,6 +188,15 @@ class LoginCaptin extends StatelessWidget {
|
||||
displayFullTextOnTap: true,
|
||||
stopPauseOnTap: true,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
box.remove(BoxName.agreeTerms);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.delete,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
@@ -216,10 +229,34 @@ class LoginCaptin extends StatelessWidget {
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Text(
|
||||
'By selecting "I Agree" below, I have reviewed and agree to the Terms of Use and acknowledge the Privacy Notice. I am at least 18 years of age.'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
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,
|
||||
@@ -248,7 +285,7 @@ class LoginCaptin extends StatelessWidget {
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Submit'.tr,
|
||||
onPressed: () => controller.saveAgreementTerms())
|
||||
onPressed: () => controller.saveAgreementTerms()),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
114
lib/views/home/Captin/bottom_bar.dart
Normal file
114
lib/views/home/Captin/bottom_bar.dart
Normal file
@@ -0,0 +1,114 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
|
||||
class BottomBarController extends GetxController {
|
||||
var currentIndex = 0.obs;
|
||||
|
||||
void changePage(int index) {
|
||||
currentIndex.value = index;
|
||||
}
|
||||
}
|
||||
|
||||
class HomeScreen extends StatelessWidget {
|
||||
final BottomBarController controller = Get.put(BottomBarController());
|
||||
|
||||
HomeScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Bottom Bar Example'),
|
||||
),
|
||||
body: Obx(() => IndexedStack(
|
||||
index: controller.currentIndex.value,
|
||||
children: const [
|
||||
HomeView(),
|
||||
ProfileView(),
|
||||
StatisticsView(),
|
||||
WalletView(),
|
||||
],
|
||||
)),
|
||||
bottomNavigationBar: Obx(() => BottomNavigationBar(
|
||||
backgroundColor: Colors.greenAccent,
|
||||
currentIndex: controller.currentIndex.value,
|
||||
onTap: controller.changePage,
|
||||
items: const [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.home,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
label: 'Home',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.person,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
label: 'Profile',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.bar_chart,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
label: 'Statistics',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.account_balance_wallet,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
label: 'Wallet',
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class HomeView extends StatelessWidget {
|
||||
const HomeView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Center(
|
||||
child: Text('Home View'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ProfileView extends StatelessWidget {
|
||||
const ProfileView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Center(
|
||||
child: Text('Profile View'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class StatisticsView extends StatelessWidget {
|
||||
const StatisticsView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Center(
|
||||
child: Text('Statistics View'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class WalletView extends StatelessWidget {
|
||||
const WalletView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Center(
|
||||
child: Text('Wallet View'),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -24,151 +24,261 @@ class CameraWidgetCardId extends StatelessWidget {
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
child: GetBuilder<CameraClassController>(
|
||||
builder: (cameraClassController) => cameraClassController
|
||||
.isCameraInitialized
|
||||
? Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: Get.width * 3 / 4,
|
||||
width: Get.width,
|
||||
child: OverflowBox(
|
||||
alignment: Alignment.center,
|
||||
child: FittedBox(
|
||||
fit: BoxFit.fitWidth,
|
||||
child: SizedBox(
|
||||
width: Get.width,
|
||||
height: Get.width *
|
||||
3 /
|
||||
4, // Set the desired aspect ratio here
|
||||
child:
|
||||
// Image.asset(
|
||||
// 'assets/images/cardid.jpg',
|
||||
// fit: BoxFit.fill,
|
||||
// )
|
||||
CameraPreview(
|
||||
cameraClassController.cameraController,
|
||||
builder: (cameraClassController) =>
|
||||
cameraClassController.isCameraInitialized
|
||||
? Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: FittedBox(
|
||||
fit: BoxFit.fitWidth,
|
||||
child: SizedBox(
|
||||
width: Get.width * .9,
|
||||
height: Get.width *
|
||||
.9, // Set the desired aspect ratio here
|
||||
child: CameraPreview(
|
||||
cameraClassController.cameraController,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 72,
|
||||
child: Container(
|
||||
width: 230,
|
||||
height: 25,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.yellowColor, width: 2),
|
||||
Positioned(
|
||||
top: 72,
|
||||
child: Container(
|
||||
width: 230,
|
||||
height: 25,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.yellowColor,
|
||||
width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 60,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 230,
|
||||
height: 25,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 156,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 175,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 191,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 207,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 225,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 115,
|
||||
left: 25,
|
||||
child: Container(
|
||||
width: 120,
|
||||
height: 110,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: Get.width * 3 / 4,
|
||||
width: Get.width,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Camera not initilaized yet',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
MyElevatedButton(
|
||||
title: 'Scan ID MklGoogle'.tr,
|
||||
onPressed: () =>
|
||||
cameraClassController.takePictureAndMLGoogleScan()),
|
||||
MyElevatedButton(
|
||||
title: 'Scan ID Tesseract'.tr,
|
||||
onPressed: () =>
|
||||
cameraClassController.takePictureAndTesseractScan()),
|
||||
],
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Scan ID Api'.tr,
|
||||
onPressed: () => cameraClassController.extractCardId()),
|
||||
GetBuilder<CameraClassController>(
|
||||
builder: (cameraClassController) => Expanded(
|
||||
child:
|
||||
Text(cameraClassController.scannedText.toString())))
|
||||
],
|
||||
)
|
||||
],
|
||||
isleading: true);
|
||||
}
|
||||
}
|
||||
|
||||
class CameraWidgetPassPort extends StatelessWidget {
|
||||
final CameraClassController cameraClassController =
|
||||
Get.put(CameraClassController());
|
||||
|
||||
CameraWidgetPassPort({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MyScafolld(
|
||||
title: 'Scan Id'.tr,
|
||||
body: [
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
child: GetBuilder<CameraClassController>(
|
||||
builder: (cameraClassController) =>
|
||||
cameraClassController.isCameraInitialized
|
||||
? Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: FittedBox(
|
||||
fit: BoxFit.fitWidth,
|
||||
child: SizedBox(
|
||||
width: Get.width * .9,
|
||||
height: Get.width *
|
||||
.9, // Set the desired aspect ratio here
|
||||
child: CameraPreview(
|
||||
cameraClassController.cameraController,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 35,
|
||||
left: 35,
|
||||
width: Get.width * .77,
|
||||
height:
|
||||
17, //left":95.0,"top":134.0,"width":2909.0,"height":175.0
|
||||
child: Container(
|
||||
// width: 230,
|
||||
// height: 25,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.yellowColor,
|
||||
width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 60,
|
||||
right: 25,
|
||||
width: 90,
|
||||
height: 25,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 110,
|
||||
right: 90,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: Get.width * 3 / 4,
|
||||
width: Get.width,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Camera not initilaized yet',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 60,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 230,
|
||||
height: 25,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 156,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 175,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 191,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 207,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 225,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 115,
|
||||
left: 25,
|
||||
child: Container(
|
||||
width: 120,
|
||||
height: 110,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: Get.width * 3 / 4,
|
||||
width: Get.width,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Camera not initilaized yet',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:camera/camera.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/info.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/constant/table_names.dart';
|
||||
import 'package:ride/controller/functions/camer_controller.dart';
|
||||
@@ -10,6 +11,7 @@ import 'package:ride/controller/home/captin/order_request_controller.dart';
|
||||
import 'package:ride/controller/payment/payment_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/Rate/ride_calculate_driver.dart';
|
||||
import 'package:ride/views/home/Captin/bottom_bar.dart';
|
||||
import 'package:ride/views/home/Captin/camer_widget.dart';
|
||||
import 'package:ride/views/home/Captin/text_scanner.dart';
|
||||
import 'package:ride/views/widgets/circle_container.dart';
|
||||
@@ -19,6 +21,7 @@ import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
import '../../../controller/functions/location_controller.dart';
|
||||
import '../../../controller/functions/ocr_controller.dart';
|
||||
import '../../../controller/home/captin/widget/connect.dart';
|
||||
import 'passportimage.dart';
|
||||
|
||||
class HomeCaptain extends StatelessWidget {
|
||||
const HomeCaptain({super.key});
|
||||
@@ -109,18 +112,36 @@ class HomeCaptain extends StatelessWidget {
|
||||
width: Get.width * .8,
|
||||
height: 80,
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Entypo.wallet,
|
||||
color: AppColor.greenColor,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Entypo.wallet,
|
||||
color: AppColor.greenColor,
|
||||
),
|
||||
Text(
|
||||
' You Earn today is '.tr +
|
||||
homeCaptainController.totalMoneyToday,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
' You Earn today is '.tr +
|
||||
homeCaptainController
|
||||
.totalMoneyToday, //Todo add here number for income
|
||||
style: AppStyle.title,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Entypo.loop,
|
||||
color: AppColor.yellowColor,
|
||||
),
|
||||
Text(
|
||||
' You Have in ${AppInformation.appName} '.tr +
|
||||
homeCaptainController.totalMoneyInSEFER,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
))),
|
||||
@@ -180,20 +201,37 @@ class HomeCaptain extends StatelessWidget {
|
||||
// );
|
||||
},
|
||||
child: const Icon(MaterialIcons.message)),
|
||||
// TextButton(
|
||||
// onPressed: () {
|
||||
// Get.to(() => TextExtractionView());
|
||||
// },
|
||||
// child: const Text(
|
||||
// "Text FlutterTesseractsOcr",
|
||||
// ),
|
||||
// ),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.to(() => TextExtractionView());
|
||||
Get.to(() => PassportPage());
|
||||
},
|
||||
child: const Text(
|
||||
"Text FlutterTesseractsOcr",
|
||||
child: Text(
|
||||
'Passport '.tr,
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.to(() => TextRecognizerWidget());
|
||||
Get.to(() => PassportDataExtractorWidget());
|
||||
},
|
||||
child: Text(
|
||||
'Passport new'.tr,
|
||||
),
|
||||
),
|
||||
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.to(() => const TextRecognizerWidget());
|
||||
},
|
||||
child: const Text(
|
||||
"Text FlutterMLGoogle",
|
||||
"Driver License ML",
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
@@ -208,11 +246,20 @@ class HomeCaptain extends StatelessWidget {
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
CameraClassController().extractByAPI(
|
||||
'https://img.alwakeelnews.com/Content/Upload/large/b8109dd0d33af5195938104af6835fef.jpg');
|
||||
Get.to(
|
||||
() => CameraWidgetPassPort(),
|
||||
);
|
||||
},
|
||||
child: const Text(
|
||||
"Text By API",
|
||||
" CameraWidgetPassPort",
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.to(() => HomeScreen());
|
||||
},
|
||||
child: const Text(
|
||||
"Home Screen",
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
|
||||
46
lib/views/home/Captin/passportimage.dart
Normal file
46
lib/views/home/Captin/passportimage.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../controller/functions/ocr_controller.dart';
|
||||
|
||||
class PassportDataExtractorWidget extends StatelessWidget {
|
||||
final PassportDataExtractor passportDataExtractor =
|
||||
Get.put(PassportDataExtractor());
|
||||
final PassportDataController controller = Get.put(PassportDataController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Passport Data Extractor'),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: controller.extractDataAndDrawBoundingBoxes,
|
||||
child: const Text('Extract Data'),
|
||||
),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Stack(
|
||||
children: [
|
||||
GetBuilder<PassportDataController>(
|
||||
builder: (controller) => CustomPaint(
|
||||
painter: BoundingBoxPainter(
|
||||
controller.extractedTextWithCoordinates),
|
||||
child: GetBuilder<PassportDataExtractor>(
|
||||
builder: (controller) =>
|
||||
Image.file(File(passportDataExtractor.image!.path)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/views/widgets/mycircular.dart';
|
||||
@@ -36,99 +38,50 @@ class TextExtractionView extends StatelessWidget {
|
||||
}
|
||||
|
||||
class TextRecognizerWidget extends StatelessWidget {
|
||||
const TextRecognizerWidget({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(TextMLGoogleRecognizerController());
|
||||
return GetBuilder<TextMLGoogleRecognizerController>(
|
||||
builder: (controller) => Scaffold(
|
||||
appBar: AppBar(),
|
||||
body: Center(
|
||||
child: Text(controller.scannedText ?? ''),
|
||||
),
|
||||
));
|
||||
appBar: AppBar(),
|
||||
body: Center(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('${controller.decode['DRIVER_LICENSE'].toString()}'),
|
||||
Text('DL: ${controller.decode['dl_number'].toString()}'),
|
||||
Text(
|
||||
'Expiry Date: ${controller.decode['expiry_date'].toString()}'),
|
||||
Text('Last Name: ${controller.decode['lastName'].toString()}'),
|
||||
Text(
|
||||
'First Name: ${controller.decode['firstName'].toString()}'),
|
||||
Text('Address: ${controller.decode['address'].toString()}'),
|
||||
Text('Date of Birth: ${controller.decode['dob'].toString()}'),
|
||||
Text('RSTR: ${controller.decode['rstr'].toString()}'),
|
||||
Text('Class: ${controller.decode['class'].toString()}'),
|
||||
Text('End: ${controller.decode['end'].toString()}'),
|
||||
Text('DD: ${controller.decode['dd'].toString()}'),
|
||||
Text('Sex: ${controller.decode['sex'].toString()}'),
|
||||
Text('Hair: ${controller.decode['hair'].toString()}'),
|
||||
Text('Eyes: ${controller.decode['eyes'].toString()}'),
|
||||
// and so on for other fields
|
||||
],
|
||||
))));
|
||||
}
|
||||
}
|
||||
|
||||
// class TesseractWidget extends StatelessWidget {
|
||||
// final TesseractController controller = Get.put(TesseractController());
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// appBar: AppBar(
|
||||
// title: Text('Tesseract Implementation'),
|
||||
// ),
|
||||
// body: GetBuilder<TesseractController>(
|
||||
// builder: (controller) => Container(
|
||||
// padding: const EdgeInsets.all(16),
|
||||
// child: ListView(
|
||||
// children: <Widget>[
|
||||
// Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
// children: [
|
||||
// ElevatedButton(
|
||||
// child: Text('Select image'),
|
||||
// onPressed: controller.extractTextFromImage,
|
||||
// ),
|
||||
// controller.scanning
|
||||
// ? const MyCircularProgressIndicator()
|
||||
// : const Icon(Icons.done),
|
||||
// SizedBox(height: 16),
|
||||
// Center(child: SelectableText(controller.text)),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:image_picker/image_picker.dart';
|
||||
//
|
||||
// import '../../../controller/functions/document_scanner.dart';
|
||||
//
|
||||
// class TextScanner extends StatelessWidget {
|
||||
// // final ImagePickerController _imagePickerController =
|
||||
// // Get.put(ImagePickerController());
|
||||
//
|
||||
// TextScanner({super.key});
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// appBar: AppBar(
|
||||
// title: const Text('Image Picker'),
|
||||
// ),
|
||||
// body: Center(
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Obx(() {
|
||||
// // final bool textScanning =
|
||||
// // _imagePickerController.textScanning.value;
|
||||
// // final String scannedText =
|
||||
// // _imagePickerController.scannedText.value;
|
||||
//
|
||||
// if (textScanning) {
|
||||
// return const CircularProgressIndicator();
|
||||
// } else if (scannedText.isNotEmpty) {
|
||||
// return Text(scannedText);
|
||||
// } else {
|
||||
// return const Text('No text scanned');
|
||||
// }
|
||||
// }),
|
||||
// ElevatedButton(
|
||||
// onPressed: () =>
|
||||
// _imagePickerController.getImage(ImageSource.camera),
|
||||
// child: const Text('Take Picture'),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
class PassportPage extends StatelessWidget {
|
||||
PassportPage({super.key});
|
||||
PassportRecognizerController passportRecognizerController =
|
||||
Get.put(PassportRecognizerController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Driver License'),
|
||||
),
|
||||
body: const Center(child: Text('data')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,33 +61,33 @@ class TimerToPassengerFromDriver extends StatelessWidget {
|
||||
)
|
||||
],
|
||||
),
|
||||
controller.remainingTimeToPassengerFromDriverAfterApplied < 60
|
||||
? MyElevatedButton(
|
||||
title: 'If you in Car Now. Press Start The Ride'.tr,
|
||||
onPressed: () async {
|
||||
//todo start the trip and rest all counter ,start new counter of the trip time
|
||||
|
||||
await CRUD()
|
||||
.post(link: AppLink.updateRides, payload: {
|
||||
'id': controller.rideId,
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Applied'
|
||||
});
|
||||
controller.driverArrivePassenger();
|
||||
// Send notification to driver to alert him that trip is begin
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToAnyWithoutData(
|
||||
'BeginTrip',
|
||||
box.read(BoxName.name).toString(),
|
||||
controller.driverToken.toString(),
|
||||
);
|
||||
print(controller.driverToken.toString());
|
||||
// Get.defaultDialog(
|
||||
// title: 'The Ride is Begin'.tr,
|
||||
// backgroundColor: AppColor.greenColor,
|
||||
// );
|
||||
})
|
||||
: const SizedBox()
|
||||
// controller.remainingTimeToPassengerFromDriverAfterApplied < 60
|
||||
// ? MyElevatedButton(
|
||||
// title: 'If you in Car Now. Press Start The Ride'.tr,
|
||||
// onPressed: () async {
|
||||
// //todo start the trip and rest all counter ,start new counter of the trip time
|
||||
//
|
||||
// await CRUD()
|
||||
// .post(link: AppLink.updateRides, payload: {
|
||||
// 'id': controller.rideId,
|
||||
// 'rideTimeStart': DateTime.now().toString(),
|
||||
// 'status': 'Applied'
|
||||
// });
|
||||
// controller.driverArrivePassenger();
|
||||
// // Send notification to driver to alert him that trip is begin
|
||||
// FirebaseMessagesController()
|
||||
// .sendNotificationToAnyWithoutData(
|
||||
// 'BeginTrip',
|
||||
// box.read(BoxName.name).toString(),
|
||||
// controller.driverToken.toString(),
|
||||
// );
|
||||
// print(controller.driverToken.toString());
|
||||
// // Get.defaultDialog(
|
||||
// // title: 'The Ride is Begin'.tr,
|
||||
// // backgroundColor: AppColor.greenColor,
|
||||
// // );
|
||||
// })
|
||||
// : const SizedBox()
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user