Merge branch 'refs/heads/design_3.0_task_module_new_merge' into design_3.0_asset_inventory_module
						commit
						dfef9aadb7
					
				| @ -1,6 +1,6 @@ | ||||
| #Thu Oct 24 09:39:31 AST 2024 | ||||
| distributionBase=GRADLE_USER_HOME | ||||
| distributionPath=wrapper/dists | ||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip | ||||
| zipStoreBase=GRADLE_USER_HOME | ||||
| zipStorePath=wrapper/dists | ||||
| @ -1,72 +1,73 @@ | ||||
| import 'dart:io'; | ||||
| 
 | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:qr_code_scanner/qr_code_scanner.dart'; | ||||
| import 'package:test_sa/extensions/context_extension.dart'; | ||||
| import 'package:test_sa/extensions/int_extensions.dart'; | ||||
| import 'package:test_sa/new_views/common_widgets/default_app_bar.dart'; | ||||
| 
 | ||||
| 
 | ||||
| class ScanQrView extends StatefulWidget { | ||||
|   const ScanQrView({Key? key}) : super(key: key); | ||||
| 
 | ||||
|   @override | ||||
|   _ScanQrViewState createState() => _ScanQrViewState(); | ||||
| } | ||||
| 
 | ||||
| class _ScanQrViewState extends State<ScanQrView> { | ||||
|   // Barcode result; | ||||
|   QRViewController? _controller; | ||||
|   bool _scanDone = false; | ||||
|   final GlobalKey qrKey = GlobalKey(debugLabel: 'QR_scanner'); | ||||
| 
 | ||||
|   // In order to get hot reload to work we need to pause the camera if the platform | ||||
|   // is android, or resume the camera if the platform is iOS. | ||||
|   @override | ||||
|   void reassemble() { | ||||
|     super.reassemble(); | ||||
|     if (Platform.isAndroid) { | ||||
|       _controller?.pauseCamera(); | ||||
|     } else if (Platform.isIOS) { | ||||
|       _controller?.resumeCamera(); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   void dispose() { | ||||
|     super.dispose(); | ||||
|     _controller?.dispose(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Scaffold( | ||||
| 
 | ||||
|       body: Stack( | ||||
|         children: [ | ||||
|           QRView( | ||||
|             key: qrKey, | ||||
|             onQRViewCreated: (QRViewController controller) { | ||||
|               setState(() { | ||||
|                 _controller = controller; | ||||
|               }); | ||||
|               controller.scannedDataStream.listen((scanData) { | ||||
|                 if (!_scanDone) { | ||||
|                   _scanDone = true; | ||||
|                   Navigator.of(context).pop(scanData.code); | ||||
|                 } | ||||
|               }); | ||||
|             }, | ||||
|             overlay: QrScannerOverlayShape(borderColor: Colors.red, borderRadius: 10, borderLength: 30, borderWidth: 10, cutOutSize: 280), | ||||
|           ), | ||||
|           Padding( | ||||
|             padding: const EdgeInsets.all(12.0), | ||||
|             child:  SizedBox( | ||||
|               height: 100.toScreenHeight, | ||||
|                 child: DefaultAppBar(title: context.translation.scanQr)), | ||||
|           ) | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| // import 'dart:io'; | ||||
| // | ||||
| // @todo delete | ||||
| // import 'package:flutter/material.dart'; | ||||
| // import 'package:qr_code_scanner/qr_code_scanner.dart'; | ||||
| // import 'package:test_sa/extensions/context_extension.dart'; | ||||
| // import 'package:test_sa/extensions/int_extensions.dart'; | ||||
| // import 'package:test_sa/new_views/common_widgets/default_app_bar.dart'; | ||||
| // | ||||
| // | ||||
| // class ScanQrView extends StatefulWidget { | ||||
| //   const ScanQrView({Key? key}) : super(key: key); | ||||
| // | ||||
| //   @override | ||||
| //   _ScanQrViewState createState() => _ScanQrViewState(); | ||||
| // } | ||||
| // | ||||
| // class _ScanQrViewState extends State<ScanQrView> { | ||||
| //   // Barcode result; | ||||
| //   QRViewController? _controller; | ||||
| //   bool _scanDone = false; | ||||
| //   final GlobalKey qrKey = GlobalKey(debugLabel: 'QR_scanner'); | ||||
| // | ||||
| //   // In order to get hot reload to work we need to pause the camera if the platform | ||||
| //   // is android, or resume the camera if the platform is iOS. | ||||
| //   @override | ||||
| //   void reassemble() { | ||||
| //     super.reassemble(); | ||||
| //     if (Platform.isAndroid) { | ||||
| //       _controller?.pauseCamera(); | ||||
| //     } else if (Platform.isIOS) { | ||||
| //       _controller?.resumeCamera(); | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   void dispose() { | ||||
| //     super.dispose(); | ||||
| //     _controller?.dispose(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     return Scaffold( | ||||
| // | ||||
| //       body: Stack( | ||||
| //         children: [ | ||||
| //           QRView( | ||||
| //             key: qrKey, | ||||
| //             onQRViewCreated: (QRViewController controller) { | ||||
| //               setState(() { | ||||
| //                 _controller = controller; | ||||
| //               }); | ||||
| //               controller.scannedDataStream.listen((scanData) { | ||||
| //                 if (!_scanDone) { | ||||
| //                   _scanDone = true; | ||||
| //                   Navigator.of(context).pop(scanData.code); | ||||
| //                 } | ||||
| //               }); | ||||
| //             }, | ||||
| //             overlay: QrScannerOverlayShape(borderColor: Colors.red, borderRadius: 10, borderLength: 30, borderWidth: 10, cutOutSize: 280), | ||||
| //           ), | ||||
| //           Padding( | ||||
| //             padding: const EdgeInsets.all(12.0), | ||||
| //             child:  SizedBox( | ||||
| //               height: 100.toScreenHeight, | ||||
| //                 child: DefaultAppBar(title: context.translation.scanQr)), | ||||
| //           ) | ||||
| //         ], | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // } | ||||
|  | ||||
| @ -1,79 +1,79 @@ | ||||
| 
 | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| import 'package:qr_code_scanner/qr_code_scanner.dart'; | ||||
| import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; | ||||
| 
 | ||||
| class QrScannerDialog extends StatefulWidget { | ||||
|   @override | ||||
|   State<QrScannerDialog> createState() => _QrScannerDialogState(); | ||||
| } | ||||
| 
 | ||||
| class _QrScannerDialogState extends State<QrScannerDialog> { | ||||
|   final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); | ||||
|   Barcode? result; | ||||
|   QRViewController? controller; | ||||
|   bool isPicked = false; | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Scaffold( | ||||
|       body: Container( | ||||
|         width: double.infinity, | ||||
|         height: double.infinity, | ||||
|         color: Colors.white, | ||||
|         child: Column( | ||||
|           children: [ | ||||
|             Expanded( | ||||
|               flex: 1, | ||||
|               child: QRView( | ||||
|                 key: qrKey, | ||||
|                 onQRViewCreated: _onQRViewCreated, | ||||
|               ), | ||||
|             ), | ||||
|             // Expanded( | ||||
|             //   flex: 1, | ||||
|             //   child: Center( | ||||
|             //     child: (result != null) | ||||
|             //         ? Text( | ||||
|             //         'Barcode Type: ${result!.format}   Data: ${result!.code}') | ||||
|             //         : Text('Scan a code'), | ||||
|             //   ), | ||||
|             // ), | ||||
|             Padding( | ||||
|               padding: const EdgeInsets.all(12.0), | ||||
|               child: AppFilledButton( | ||||
|                 label: "LocaleKeys.cancel.tr()", | ||||
|                 onPressed: () { | ||||
|                   Navigator.pop(context); | ||||
|                 }, | ||||
|               ), | ||||
|             ), | ||||
|           ], | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   void _onQRViewCreated(QRViewController controller) { | ||||
|     this.controller = controller; | ||||
| 
 | ||||
|     controller.scannedDataStream.listen((scanData) { | ||||
|       setState(() { | ||||
|         result = scanData; | ||||
|         if (!isPicked) { | ||||
|           isPicked = true; | ||||
|           Navigator.pop(context, result!.code); | ||||
|         } | ||||
|       }); | ||||
|     }); | ||||
|     controller.pauseCamera(); | ||||
|     controller.resumeCamera(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   void dispose() { | ||||
|     controller?.dispose(); | ||||
|     super.dispose(); | ||||
|   } | ||||
| } | ||||
| // | ||||
| // import 'package:flutter/material.dart'; | ||||
| // | ||||
| // import 'package:qr_code_scanner/qr_code_scanner.dart'; | ||||
| // import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; | ||||
| // todo @delete | ||||
| // class QrScannerDialog extends StatefulWidget { | ||||
| //   @override | ||||
| //   State<QrScannerDialog> createState() => _QrScannerDialogState(); | ||||
| // } | ||||
| // | ||||
| // class _QrScannerDialogState extends State<QrScannerDialog> { | ||||
| //   final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); | ||||
| //   Barcode? result; | ||||
| //   QRViewController? controller; | ||||
| //   bool isPicked = false; | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     return Scaffold( | ||||
| //       body: Container( | ||||
| //         width: double.infinity, | ||||
| //         height: double.infinity, | ||||
| //         color: Colors.white, | ||||
| //         child: Column( | ||||
| //           children: [ | ||||
| //             Expanded( | ||||
| //               flex: 1, | ||||
| //               child: QRView( | ||||
| //                 key: qrKey, | ||||
| //                 onQRViewCreated: _onQRViewCreated, | ||||
| //               ), | ||||
| //             ), | ||||
| //             // Expanded( | ||||
| //             //   flex: 1, | ||||
| //             //   child: Center( | ||||
| //             //     child: (result != null) | ||||
| //             //         ? Text( | ||||
| //             //         'Barcode Type: ${result!.format}   Data: ${result!.code}') | ||||
| //             //         : Text('Scan a code'), | ||||
| //             //   ), | ||||
| //             // ), | ||||
| //             Padding( | ||||
| //               padding: const EdgeInsets.all(12.0), | ||||
| //               child: AppFilledButton( | ||||
| //                 label: "LocaleKeys.cancel.tr()", | ||||
| //                 onPressed: () { | ||||
| //                   Navigator.pop(context); | ||||
| //                 }, | ||||
| //               ), | ||||
| //             ), | ||||
| //           ], | ||||
| //         ), | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // | ||||
| //   void _onQRViewCreated(QRViewController controller) { | ||||
| //     this.controller = controller; | ||||
| // | ||||
| //     controller.scannedDataStream.listen((scanData) { | ||||
| //       setState(() { | ||||
| //         result = scanData; | ||||
| //         if (!isPicked) { | ||||
| //           isPicked = true; | ||||
| //           Navigator.pop(context, result!.code); | ||||
| //         } | ||||
| //       }); | ||||
| //     }); | ||||
| //     controller.pauseCamera(); | ||||
| //     controller.resumeCamera(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   void dispose() { | ||||
| //     controller?.dispose(); | ||||
| //     super.dispose(); | ||||
| //   } | ||||
| // } | ||||
|  | ||||
					Loading…
					
					
				
		Reference in New Issue