Showing
4 changed files
with
7 additions
and
7 deletions
| @@ -133,9 +133,9 @@ class _BarcodeScannerWithControllerState | @@ -133,9 +133,9 @@ class _BarcodeScannerWithControllerState | ||
| 133 | icon: const Icon(Icons.image), | 133 | icon: const Icon(Icons.image), |
| 134 | iconSize: 32.0, | 134 | iconSize: 32.0, |
| 135 | onPressed: () async { | 135 | onPressed: () async { |
| 136 | - final ImagePicker _picker = ImagePicker(); | 136 | + final ImagePicker picker = ImagePicker(); |
| 137 | // Pick an image | 137 | // Pick an image |
| 138 | - final XFile? image = await _picker.pickImage( | 138 | + final XFile? image = await picker.pickImage( |
| 139 | source: ImageSource.gallery, | 139 | source: ImageSource.gallery, |
| 140 | ); | 140 | ); |
| 141 | if (image != null) { | 141 | if (image != null) { |
| @@ -29,12 +29,12 @@ class MobileScanner extends StatefulWidget { | @@ -29,12 +29,12 @@ class MobileScanner extends StatefulWidget { | ||
| 29 | 29 | ||
| 30 | /// Create a [MobileScanner] with a [controller], the [controller] must has been initialized. | 30 | /// Create a [MobileScanner] with a [controller], the [controller] must has been initialized. |
| 31 | const MobileScanner({ | 31 | const MobileScanner({ |
| 32 | - Key? key, | 32 | + super.key, |
| 33 | required this.onDetect, | 33 | required this.onDetect, |
| 34 | this.controller, | 34 | this.controller, |
| 35 | this.fit = BoxFit.cover, | 35 | this.fit = BoxFit.cover, |
| 36 | this.allowDuplicates = false, | 36 | this.allowDuplicates = false, |
| 37 | - }) : super(key: key); | 37 | + }); |
| 38 | 38 | ||
| 39 | @override | 39 | @override |
| 40 | State<MobileScanner> createState() => _MobileScannerState(); | 40 | State<MobileScanner> createState() => _MobileScannerState(); |
| @@ -75,7 +75,7 @@ class _MobileScannerState extends State<MobileScanner> | @@ -75,7 +75,7 @@ class _MobileScannerState extends State<MobileScanner> | ||
| 75 | builder: (context, value, child) { | 75 | builder: (context, value, child) { |
| 76 | value = value as MobileScannerArguments?; | 76 | value = value as MobileScannerArguments?; |
| 77 | if (value == null) { | 77 | if (value == null) { |
| 78 | - return Container(color: Colors.black); | 78 | + return const ColoredBox(color: Colors.black); |
| 79 | } else { | 79 | } else { |
| 80 | controller.barcodes.listen((barcode) { | 80 | controller.barcodes.listen((barcode) { |
| 81 | if (!widget.allowDuplicates) { | 81 | if (!widget.allowDuplicates) { |
-
Please register or login to post a comment