Julian Steenbakker

doc: add changelog

@@ -3,6 +3,9 @@ You can provide a path to controller.analyzeImage(path) in order to scan a local @@ -3,6 +3,9 @@ You can provide a path to controller.analyzeImage(path) in order to scan a local
3 Check out the example app to see how you can use the image_picker plugin to retrieve a photo from 3 Check out the example app to see how you can use the image_picker plugin to retrieve a photo from
4 the gallery. Please keep in mind that this feature is only supported on Android and iOS. 4 the gallery. Please keep in mind that this feature is only supported on Android and iOS.
5 5
  6 +Another feature that has been added is a format selector!
  7 +Just keep in mind that iOS for now only supports 1 selected barcode.
  8 +
6 ## 0.1.3 9 ## 0.1.3
7 * Fixed crash after asking permission. [#29](https://github.com/juliansteenbakker/mobile_scanner/issues/29) 10 * Fixed crash after asking permission. [#29](https://github.com/juliansteenbakker/mobile_scanner/issues/29)
8 * Upgraded cameraX from 1.1.0-beta01 to 1.1.0-beta02 11 * Upgraded cameraX from 1.1.0-beta01 to 1.1.0-beta02
@@ -17,7 +17,7 @@ class _BarcodeScannerWithControllerState @@ -17,7 +17,7 @@ class _BarcodeScannerWithControllerState
17 17
18 MobileScannerController controller = MobileScannerController( 18 MobileScannerController controller = MobileScannerController(
19 torchEnabled: true, 19 torchEnabled: true,
20 - // formats: [BarcodeFormat.ean13, BarcodeFormat.ean8] 20 + // formats: [BarcodeFormat.qrCode]
21 // facing: CameraFacing.front, 21 // facing: CameraFacing.front,
22 ); 22 );
23 23
@@ -24,12 +24,9 @@ class MobileScanner extends StatefulWidget { @@ -24,12 +24,9 @@ class MobileScanner extends StatefulWidget {
24 final BoxFit fit; 24 final BoxFit fit;
25 25
26 /// Create a [MobileScanner] with a [controller], the [controller] must has been initialized. 26 /// Create a [MobileScanner] with a [controller], the [controller] must has been initialized.
27 - const MobileScanner({  
28 - Key? key,  
29 - this.onDetect,  
30 - this.controller,  
31 - this.fit = BoxFit.cover  
32 - }) : super(key: key); 27 + const MobileScanner(
  28 + {Key? key, this.onDetect, this.controller, this.fit = BoxFit.cover})
  29 + : super(key: key);
33 30
34 @override 31 @override
35 State<MobileScanner> createState() => _MobileScannerState(); 32 State<MobileScanner> createState() => _MobileScannerState();
@@ -43,6 +43,10 @@ class MobileScannerController { @@ -43,6 +43,10 @@ class MobileScannerController {
43 late final ValueNotifier<CameraFacing> cameraFacingState; 43 late final ValueNotifier<CameraFacing> cameraFacingState;
44 final Ratio? ratio; 44 final Ratio? ratio;
45 final bool? torchEnabled; 45 final bool? torchEnabled;
  46 +
  47 + /// If provided, the scanner will only detect those specific formats.
  48 + ///
  49 + /// WARNING: On iOS, only 1 format is supported.
46 final List<BarcodeFormat>? formats; 50 final List<BarcodeFormat>? formats;
47 51
48 CameraFacing facing; 52 CameraFacing facing;
@@ -52,7 +56,10 @@ class MobileScannerController { @@ -52,7 +56,10 @@ class MobileScannerController {
52 Stream<Barcode> get barcodes => barcodesController.stream; 56 Stream<Barcode> get barcodes => barcodesController.stream;
53 57
54 MobileScannerController( 58 MobileScannerController(
55 - {this.facing = CameraFacing.back, this.ratio, this.torchEnabled, this.formats}) { 59 + {this.facing = CameraFacing.back,
  60 + this.ratio,
  61 + this.torchEnabled,
  62 + this.formats}) {
56 // In case a new instance is created before calling dispose() 63 // In case a new instance is created before calling dispose()
57 if (_controllerHashcode != null) { 64 if (_controllerHashcode != null) {
58 stop(); 65 stop();
@@ -146,7 +153,6 @@ class MobileScannerController { @@ -146,7 +153,6 @@ class MobileScannerController {
146 } else if (Platform.isIOS || Platform.isMacOS) { 153 } else if (Platform.isIOS || Platform.isMacOS) {
147 arguments['formats'] = formats!.map((e) => e.rawValue).toList(); 154 arguments['formats'] = formats!.map((e) => e.rawValue).toList();
148 } 155 }
149 -  
150 } 156 }
151 157
152 // Start the camera with arguments 158 // Start the camera with arguments
@@ -554,7 +554,6 @@ enum BarcodeFormat { @@ -554,7 +554,6 @@ enum BarcodeFormat {
554 } 554 }
555 555
556 extension BarcodeValue on BarcodeFormat { 556 extension BarcodeValue on BarcodeFormat {
557 -  
558 int get rawValue { 557 int get rawValue {
559 switch (this) { 558 switch (this) {
560 case BarcodeFormat.unknown: 559 case BarcodeFormat.unknown:
@@ -589,7 +588,6 @@ extension BarcodeValue on BarcodeFormat { @@ -589,7 +588,6 @@ extension BarcodeValue on BarcodeFormat {
589 return 4096; 588 return 4096;
590 } 589 }
591 } 590 }
592 -  
593 } 591 }
594 592
595 /// Address type constants. 593 /// Address type constants.