10/27/1
This commit is contained in:
182
lib/views/home/Captin/camer_widget.dart
Normal file
182
lib/views/home/Captin/camer_widget.dart
Normal file
@@ -0,0 +1,182 @@
|
||||
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/style.dart';
|
||||
import 'package:ride/controller/functions/camer_controller.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
class CameraWidgetCardId extends StatelessWidget {
|
||||
final CameraClassController cameraClassController =
|
||||
Get.put(CameraClassController());
|
||||
|
||||
CameraWidgetCardId({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
child: GetBuilder<CameraClassController>(
|
||||
builder: (cameraClassController) => cameraClassController
|
||||
.isCameraInitialized
|
||||
? Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: Get.height * .3,
|
||||
width: Get.width,
|
||||
child:
|
||||
// Image.asset(
|
||||
// 'assets/images/cardid.jpg',
|
||||
// fit: BoxFit.cover,
|
||||
// )
|
||||
CameraPreview(
|
||||
cameraClassController.cameraController,
|
||||
// child: IconButton(
|
||||
// onPressed: () {
|
||||
// cameraClassController.takePicture();
|
||||
// },
|
||||
// icon: const Icon(Icons.camera),
|
||||
// ),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 50,
|
||||
child: Container(
|
||||
width: 230,
|
||||
height: 25,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border: Border.all(
|
||||
color: AppColor.yellowColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 38,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 230,
|
||||
height: 25,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border:
|
||||
Border.all(color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 130,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border:
|
||||
Border.all(color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 148,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border:
|
||||
Border.all(color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 165,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border:
|
||||
Border.all(color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 182,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border:
|
||||
Border.all(color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 198,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: 140,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
// color: AppColor.blueColor,
|
||||
border:
|
||||
Border.all(color: AppColor.blueColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 80,
|
||||
left: 35,
|
||||
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.height * .3,
|
||||
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()),
|
||||
],
|
||||
),
|
||||
GetBuilder<CameraClassController>(
|
||||
builder: (cameraClassController) => Expanded(
|
||||
child: Text(cameraClassController.scannedText.toString())))
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
@@ -8,6 +9,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/camer_widget.dart';
|
||||
import 'package:ride/views/home/Captin/text_scanner.dart';
|
||||
import 'package:ride/views/widgets/circle_container.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
@@ -193,6 +195,17 @@ class HomeCaptain extends StatelessWidget {
|
||||
"Text FlutterMLGoogle",
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.to(() => Scaffold(
|
||||
appBar: AppBar(),
|
||||
body: CameraWidgetCardId(),
|
||||
));
|
||||
},
|
||||
child: const Text(
|
||||
"Text IdCamera",
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
PaymentController().makePayment(
|
||||
@@ -213,3 +226,36 @@ class HomeCaptain extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// class CameraContainer extends StatelessWidget {
|
||||
// TextMLGoogleRecognizerController controller =
|
||||
// Get.put(TextMLGoogleRecognizerController());
|
||||
|
||||
// CameraContainer({super.key});
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Stack(
|
||||
// children: [
|
||||
// // The camera preview
|
||||
// SizedBox(
|
||||
// height: Get.height * 0.3,
|
||||
// width: Get.width * 0.9,
|
||||
// child: CameraPreview(controller.imagePicker as CameraController),
|
||||
// ),
|
||||
|
||||
// // The lines on the side of the name and national number
|
||||
// const Positioned(
|
||||
// bottom: 0,
|
||||
// left: 0,
|
||||
// right: 0,
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Text('Name'),
|
||||
// Text('National Number'),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user