Showing
1 changed file
with
14 additions
and
1 deletions
| @@ -7,9 +7,23 @@ enum Ratio { ratio_4_3, ratio_16_9 } | @@ -7,9 +7,23 @@ enum Ratio { ratio_4_3, ratio_16_9 } | ||
| 7 | 7 | ||
| 8 | /// A widget showing a live camera preview. | 8 | /// A widget showing a live camera preview. |
| 9 | class MobileScanner extends StatefulWidget { | 9 | class MobileScanner extends StatefulWidget { |
| 10 | + | ||
| 10 | /// The controller of the camera. | 11 | /// The controller of the camera. |
| 11 | final MobileScannerController? controller; | 12 | final MobileScannerController? controller; |
| 13 | + | ||
| 14 | + /// Function that gets called when a Barcode is detected. | ||
| 15 | + /// | ||
| 16 | + /// [barcode] The barcode object with all information about the scanned code. | ||
| 17 | + /// [args] Information about the state of the MobileScanner widget | ||
| 12 | final Function(Barcode barcode, MobileScannerArguments args)? onDetect; | 18 | final Function(Barcode barcode, MobileScannerArguments args)? onDetect; |
| 19 | + | ||
| 20 | + /// TODO: Function that gets called when the Widget is initialized. Can be usefull | ||
| 21 | + /// to check wether the device has a torch(flash) or not. | ||
| 22 | + /// | ||
| 23 | + /// [args] Information about the state of the MobileScanner widget | ||
| 24 | + // final Function(MobileScannerArguments args)? onInitialize; | ||
| 25 | + | ||
| 26 | + /// Handles how the widget should fit the screen. | ||
| 13 | final BoxFit fit; | 27 | final BoxFit fit; |
| 14 | 28 | ||
| 15 | /// Create a [MobileScanner] with a [controller], the [controller] must has been initialized. | 29 | /// Create a [MobileScanner] with a [controller], the [controller] must has been initialized. |
| @@ -64,7 +78,6 @@ class _MobileScannerState extends State<MobileScanner> | @@ -64,7 +78,6 @@ class _MobileScannerState extends State<MobileScanner> | ||
| 64 | } else { | 78 | } else { |
| 65 | controller.barcodes.listen( | 79 | controller.barcodes.listen( |
| 66 | (a) => widget.onDetect!(a, value as MobileScannerArguments)); | 80 | (a) => widget.onDetect!(a, value as MobileScannerArguments)); |
| 67 | - debugPrint(' size MediaQuery ${MediaQuery.of(context).size}'); | ||
| 68 | return ClipRect( | 81 | return ClipRect( |
| 69 | child: SizedBox( | 82 | child: SizedBox( |
| 70 | width: MediaQuery.of(context).size.width, | 83 | width: MediaQuery.of(context).size.width, |
-
Please register or login to post a comment