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'; import 'package:ride/views/widgets/my_scafold.dart'; class CameraWidgetCardId extends StatelessWidget { final CameraClassController cameraClassController = Get.put(CameraClassController()); CameraWidgetCardId({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( 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( builder: (cameraClassController) => Expanded( child: Text(cameraClassController.scannedText.toString()))) ], ) ], isleading: true); } }