This commit is contained in:
Hamza-Ayed
2023-10-27 18:53:56 +03:00
parent eabb7f0e54
commit c4285cface
2 changed files with 176 additions and 168 deletions

View File

@@ -5,6 +5,7 @@ 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';
import 'package:ride/views/widgets/my_scafold.dart';
class CameraWidgetCardId extends StatelessWidget {
final CameraClassController cameraClassController =
@@ -14,169 +15,177 @@ class CameraWidgetCardId extends StatelessWidget {
@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())))
],
);
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,
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())))
],
)
],
isleading: true);
}
}