From c4285cfaced0afe190352c9f37d62388c4aae470 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Fri, 27 Oct 2023 18:53:56 +0300 Subject: [PATCH] 10/27/3 --- lib/views/home/Captin/camer_widget.dart | 337 ++++++++++++------------ lib/views/home/Captin/home_captin.dart | 7 +- 2 files changed, 176 insertions(+), 168 deletions(-) diff --git a/lib/views/home/Captin/camer_widget.dart b/lib/views/home/Captin/camer_widget.dart index 1d15cf7..cbb76a5 100644 --- a/lib/views/home/Captin/camer_widget.dart +++ b/lib/views/home/Captin/camer_widget.dart @@ -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( - 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()))) - ], - ); + 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); } } diff --git a/lib/views/home/Captin/home_captin.dart b/lib/views/home/Captin/home_captin.dart index 98f143e..c67e20f 100644 --- a/lib/views/home/Captin/home_captin.dart +++ b/lib/views/home/Captin/home_captin.dart @@ -197,10 +197,9 @@ class HomeCaptain extends StatelessWidget { ), TextButton( onPressed: () { - Get.to(() => Scaffold( - appBar: AppBar(), - body: CameraWidgetCardId(), - )); + Get.to( + () => CameraWidgetCardId(), + ); }, child: const Text( "Text IdCamera",