Skip to content

Commit 52ee460

Browse files
authored
Merge pull request #56 from rvndsngwn/master
## 3.4.1
2 parents 54eb075 + a3b3c99 commit 52ee460

File tree

9 files changed

+282
-335
lines changed

9 files changed

+282
-335
lines changed

.flutter-plugins

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# This is a generated file; do not edit or check into version control.
2-
mobile_scanner=/Users/arvind/.pub-cache/hosted/pub.dev/mobile_scanner-3.3.0/
2+
mobile_scanner=/Users/arvind/.pub-cache/hosted/pub.dev/mobile_scanner-3.4.1/

.flutter-plugins-dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mobile_scanner","path":"/Users/arvind/.pub-cache/hosted/pub.dev/mobile_scanner-3.3.0/","native_build":true,"dependencies":[]}],"android":[{"name":"mobile_scanner","path":"/Users/arvind/.pub-cache/hosted/pub.dev/mobile_scanner-3.3.0/","native_build":true,"dependencies":[]}],"macos":[{"name":"mobile_scanner","path":"/Users/arvind/.pub-cache/hosted/pub.dev/mobile_scanner-3.3.0/","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"mobile_scanner","path":"/Users/arvind/.pub-cache/hosted/pub.dev/mobile_scanner-3.3.0/","dependencies":[]}]},"dependencyGraph":[{"name":"mobile_scanner","dependencies":[]}],"date_created":"2023-07-03 13:36:32.059509","version":"3.10.5"}
1+
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mobile_scanner","path":"/Users/arvind/.pub-cache/hosted/pub.dev/mobile_scanner-3.4.1/","native_build":true,"dependencies":[]}],"android":[{"name":"mobile_scanner","path":"/Users/arvind/.pub-cache/hosted/pub.dev/mobile_scanner-3.4.1/","native_build":true,"dependencies":[]}],"macos":[{"name":"mobile_scanner","path":"/Users/arvind/.pub-cache/hosted/pub.dev/mobile_scanner-3.4.1/","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"mobile_scanner","path":"/Users/arvind/.pub-cache/hosted/pub.dev/mobile_scanner-3.4.1/","dependencies":[]}]},"dependencyGraph":[{"name":"mobile_scanner","dependencies":[]}],"date_created":"2023-10-02 23:08:02.151393","version":"3.13.6"}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## 3.4.1
2+
3+
- Jump to 3.4.1 to match the version of mobile_scanner
4+
- Dependency updates
5+
- mobile_scanner: ^3.4.1
6+
- readme updated
7+
- topics added
8+
- Major changes in AiBarcodeScanner class
9+
- allowDuplicates, hintMargin, hintPadding, hintBackgroundColor, errorText and successText removed
10+
- hintWidget => bottomBar
11+
- hintText => bottomBarText
12+
- hintTextStyle => bottomBarTextStyle
13+
- appBar added
14+
115
## 0.0.7-dev.1
216

317
- error widget fixed

README.md

Lines changed: 120 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,7 @@
33
[![pub package](https://img.shields.io/pub/v/ai_barcode_scanner.svg)](https://pub.dev/packages/ai_barcode_scanner)
44
[![GitHub Sponsors](https://img.shields.io/github/sponsors/juliansteenbakker?label=Sponsor%20Julian%20Steenbakker!)](https://github.com/sponsors/juliansteenbakker)
55

6-
### Note:
7-
8-
_This plugin is based on the [mobile_scanner](https://pub.dev/packages/mobile_scanner) plugin by [steenbakker.dev](https://pub.dev/publishers/steenbakker.dev/packages)._
9-
10-
_Huge thanks to [Julian Steenbakker](https://github.com/sponsors/juliansteenbakker)_ 🙏
11-
12-
An universal barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS.
13-
14-
### What's deferent from [mobile_scanner](https://pub.dev/packages/mobile_scanner)?
15-
16-
_The only difference is that this plugin provides a ready to use UI widget with customizable options._
17-
18-
### Preview of the widget
6+
### Screenshots
197

208
<table>
219
<tr>
@@ -28,45 +16,61 @@ _The only difference is that this plugin provides a ready to use UI widget with
2816
</tr>
2917
</table>
3018

19+
20+
## Features Supported
21+
22+
See the example app for detailed implementation information.
23+
24+
| Features | Android | iOS | macOS | Web |
25+
|------------------------|--------------------|--------------------|-------|-----|
26+
| analyzeImage (Gallery) | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
27+
| returnImage | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
28+
| scanWindow | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
29+
| barcodeOverlay | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
30+
3131
## Platform Support
3232

3333
| Android | iOS | macOS | Web | Linux | Windows |
34-
| ------- | --- | ----- | --- | ----- | ------- |
35-
| || || | |
34+
|---------|-----|-------|-----|-------|---------|
35+
| || || :x: | :x: |
3636

37-
## Platform specific setup
3837

39-
### Android
4038

39+
## Platform specific setup
40+
### Android
4141
This packages uses the **bundled version** of MLKit Barcode-scanning for Android. This version is more accurate and immediately available to devices. However, this version will increase the size of the app with approximately 3 to 10 MB. The alternative for this is to use the **unbundled version** of MLKit Barcode-scanning for Android. This version is older than the bundled version however this only increases the size by around 600KB.
4242
To use this version you must alter the mobile_scanner gradle file to replace `com.google.mlkit:barcode-scanning:17.0.2` with `com.google.android.gms:play-services-mlkit-barcode-scanning:18.0.0`. Keep in mind that if you alter the gradle files directly in your project it can be overriden when you update your pubspec.yaml. I am still searching for a way to properly replace the module in gradle but have yet to find one.
4343

4444
[You can read more about the difference between the two versions here.](https://developers.google.com/ml-kit/vision/barcode-scanning/android)
4545

4646
### iOS
47-
4847
**Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:**
4948
NSCameraUsageDescription - describe why your app needs access to the camera. This is called Privacy - Camera Usage Description in the visual editor.
5049

5150
**If you want to use the local gallery feature from [image_picker](https://pub.dev/packages/image_picker)**
5251
NSPhotoLibraryUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.
5352

5453
Example,
54+
```
55+
<key>NSCameraUsageDescription</key>
56+
<string>This app needs camera access to scan QR codes</string>
57+
58+
<key>NSPhotoLibraryUsageDescription</key>
59+
<string>This app needs photos access to get QR code from photo library</string>
60+
```
5561

56-
```
57-
<key>NSCameraUsageDescription</key>
58-
<string>This app needs camera access to scan QR codes</string>
59-
60-
<key>NSPhotoLibraryUsageDescription</key>
61-
<string>This app needs photos access to get QR code from photo library</string>
62-
```
6362

6463
### macOS
65-
6664
Ensure that you granted camera permission in XCode -> Signing & Capabilities:
6765

6866
<img width="696" alt="Screenshot of XCode where Camera is checked" src="https://user-images.githubusercontent.com/24459435/193464115-d76f81d0-6355-4cb2-8bee-538e413a3ad0.png">
6967

68+
## Web
69+
This package uses ZXing on web to read barcodes so it needs to be included in `index.html` as script.
70+
```html
71+
<script src="https://unpkg.com/@zxing/[email protected]" type="application/javascript"></script>
72+
```
73+
7074
## Usage ([ai_barcode_scanner](https://pub.dev/packages/ai_barcode_scanner))
7175

7276
Import `package:ai_barcode_scanner/ai_barcode_scanner.dart`, and use the widget with or without the controller.
@@ -90,7 +94,9 @@ AiBarcodeScanner(
9094
9195
/// Example of using the barcode scanner with a controller.
9296
AiBarcodeScanner(
93-
controller: MobileScannerController(),
97+
controller: MobileScannerController(
98+
detectionSpeed: DetectionSpeed.noDuplicates,
99+
),
94100
onScan: (String value) {
95101
debugPrint(value);
96102
},
@@ -117,6 +123,9 @@ AiBarcodeScanner(
117123

118124
## Usage ([mobile_scanner](https://pub.dev/packages/mobile_scanner))
119125

126+
127+
## Usage
128+
120129
Import `package:mobile_scanner/mobile_scanner.dart`, and use the widget with or without the controller.
121130

122131
If you don't provide a controller, you can't control functions like the torch(flash) or switching camera.
@@ -279,14 +288,14 @@ import 'package:mobile_scanner/mobile_scanner.dart';
279288
The onDetect function returns a BarcodeCapture objects which contains the following items.
280289

281290
| Property name | Type | Description |
282-
| ------------- | ------------- | --------------------------------- |
291+
|---------------|---------------|-----------------------------------|
283292
| barcodes | List<Barcode> | A list with scanned barcodes. |
284293
| image | Uint8List? | If enabled, an image of the scan. |
285294

286295
You can use the following properties of the Barcode object.
287296

288297
| Property name | Type | Description |
289-
| ------------- | -------------- | ----------------------------------- |
298+
|---------------|----------------|-------------------------------------|
290299
| format | BarcodeFormat | |
291300
| rawBytes | Uint8List? | binary scan result |
292301
| rawValue | String? | Value if barcode is in UTF-8 format |
@@ -306,142 +315,117 @@ You can use the following properties of the Barcode object.
306315

307316
```dart
308317
/// Function that gets Called when barcode is scanned successfully
309-
///
310-
final void Function(String) onScan;
311-
312-
/// Function that gets called when a Barcode is detected.
313-
///
314-
/// [barcode] The barcode object with all information about the scanned code.
315-
/// [args] Information about the state of the MobileScanner widget
316-
final void Function(BarcodeCapture)? onDetect;
317-
318-
/// Validate barcode text with [ValidateType]
319-
/// [validateText] and [validateType] must be set together.
320-
/// [validateText] now deprecated, use [validator] instead.
321-
@Deprecated('Use [validator] instead. This will be removed in next version.')
322-
final String? validateText;
323-
324-
/// Validate type [ValidateType]
325-
/// Validator working with single string value only.
326-
/// [validateText] and [validateType] now deprecated, use [validator] instead.
327-
@Deprecated('Use [validator] instead. This will be removed in next version.')
328-
final ValidateType? validateType;
329-
330-
/// Validate barcode text with a function
331-
final bool Function(String value)? validator;
332-
333-
/// Set to false if you don't want duplicate barcode to be detected
334-
final bool allowDuplicates;
335-
336-
/// Fit to screen
337-
final BoxFit fit;
338-
339-
/// Barcode controller (optional)
340-
final MobileScannerController? controller;
318+
///
319+
final void Function(String) onScan;
341320
342-
/// Show overlay or not (default: true)
343-
final bool showOverlay;
321+
/// Function that gets called when a Barcode is detected.
322+
///
323+
/// [barcode] The barcode object with all information about the scanned code.
324+
/// [args] Information about the state of the MobileScanner widget
325+
final void Function(BarcodeCapture)? onDetect;
344326
345-
/// Overlay border color (default: white)
346-
final Color borderColor;
327+
/// Validate barcode text with a function
328+
final bool Function(String value)? validator;
347329
348-
/// Overlay border width (default: 10)
349-
final double borderWidth;
330+
/// Fit to screen
331+
final BoxFit fit;
350332
351-
/// Overlay color
352-
final Color overlayColor;
333+
/// Barcode controller (optional)
334+
final MobileScannerController? controller;
353335
354-
/// Overlay border radius (default: 10)
355-
final double borderRadius;
336+
/// Show overlay or not (default: true)
337+
final bool showOverlay;
356338
357-
/// Overlay border length (default: 30)
358-
final double borderLength;
339+
/// Overlay border color (default: white)
340+
final Color borderColor;
359341
360-
/// Overlay cut out width (optional)
361-
final double? cutOutWidth;
342+
/// Overlay border width (default: 10)
343+
final double borderWidth;
362344
363-
/// Overlay cut out height (optional)
364-
final double? cutOutHeight;
345+
/// Overlay color
346+
final Color overlayColor;
365347
366-
/// Overlay cut out offset (default: 0)
367-
final double cutOutBottomOffset;
348+
/// Overlay border radius (default: 10)
349+
final double borderRadius;
368350
369-
/// Overlay cut out size (default: 300)
370-
final double cutOutSize;
351+
/// Overlay border length (default: 30)
352+
final double borderLength;
371353
372-
/// Hint widget (optional) (default: Text('Scan QR Code'))
373-
/// Hint widget will be replaced the bottom of the screen.
374-
/// If you want to replace the bottom screen widget, use [hintWidget]
375-
final Widget? hintWidget;
354+
/// Overlay cut out width (optional)
355+
final double? cutOutWidth;
376356
377-
/// Hint text (default: 'Scan QR Code')
378-
final String hintText;
357+
/// Overlay cut out height (optional)
358+
final double? cutOutHeight;
379359
380-
/// Hint margin
381-
final EdgeInsetsGeometry hintMargin;
360+
/// Overlay cut out offset (default: 0)
361+
final double cutOutBottomOffset;
382362
383-
/// Hint padding
384-
final EdgeInsetsGeometry hintPadding;
363+
/// Overlay cut out size (default: 300)
364+
final double cutOutSize;
385365
386-
/// Hint background color (optional)
387-
final Color? hintBackgroundColor;
366+
/// Hint widget (optional) (default: Text('Scan QR Code'))
367+
/// Hint widget will be replaced the bottom of the screen.
368+
/// If you want to replace the bottom screen widget, use [bottomBar]
369+
final Widget? bottomBar;
388370
389-
/// Hint text style
390-
final TextStyle hintTextStyle;
371+
/// Hint text (default: 'Scan QR Code')
372+
final String bottomBarText;
391373
392-
/// Show error or not (default: true)
393-
final bool showError;
374+
/// Hint text style
375+
final TextStyle bottomBarTextStyle;
394376
395-
/// Error color (default: red)
396-
final Color errorColor;
377+
/// Show error or not (default: true)
378+
final bool showError;
397379
398-
/// Error text (default: 'Invalid BarCode')
399-
final String errorText;
380+
/// Error color (default: red)
381+
final Color errorColor;
400382
401-
/// Show success or not (default: true)
402-
final bool showSuccess;
383+
/// Show success or not (default: true)
384+
final bool showSuccess;
403385
404-
/// Success color (default: green)
405-
final Color successColor;
386+
/// Success color (default: green)
387+
final Color successColor;
406388
407-
/// Success text (default: 'BarCode Found')
408-
final String successText;
389+
/// Can auto back to previous page when barcode is successfully scanned (default: true)
390+
final bool canPop;
409391
410-
/// Can auto back to previous page when barcode is successfully scanned (default: true)
411-
final bool canPop;
392+
/// The function that builds an error widget when the scanner
393+
/// could not be started.
394+
///
395+
/// If this is null, defaults to a black [ColoredBox]
396+
/// with a centered white [Icons.error] icon.
397+
final Widget Function(BuildContext, MobileScannerException, Widget?)?
398+
errorBuilder;
412399
413-
/// The function that builds an error widget when the scanner
414-
/// could not be started.
415-
///
416-
/// If this is null, defaults to a black [ColoredBox]
417-
/// with a centered white [Icons.error] icon.
418-
final Widget Function(BuildContext, MobileScannerException, Widget?)?
419-
errorBuilder;
400+
/// The function that builds a placeholder widget when the scanner
401+
/// is not yet displaying its camera preview.
402+
///
403+
/// If this is null, a black [ColoredBox] is used as placeholder.
404+
final Widget Function(BuildContext, Widget?)? placeholderBuilder;
420405
421-
/// The function that builds a placeholder widget when the scanner
422-
/// is not yet displaying its camera preview.
423-
///
424-
/// If this is null, a black [ColoredBox] is used as placeholder.
425-
final Widget Function(BuildContext, Widget?)? placeholderBuilder;
406+
/// The function that signals when the barcode scanner is started.
407+
final void Function(MobileScannerArguments?)? onScannerStarted;
426408
427-
/// The function that signals when the barcode scanner is started.
428-
final void Function(MobileScannerArguments?)? onScannerStarted;
409+
/// Called when this object is removed from the tree permanently.
410+
final void Function()? onDispose;
429411
430-
/// Called when this object is removed from the tree permanently.
431-
final void Function()? onDispose;
412+
/// if set barcodes will only be scanned if they fall within this [Rect]
413+
/// useful for having a cut-out overlay for example. these [Rect]
414+
/// coordinates are relative to the widget size, so by how much your
415+
/// rectangle overlays the actual image can depend on things like the
416+
/// [BoxFit]
417+
final Rect? scanWindow;
432418
433-
/// if set barcodes will only be scanned if they fall within this [Rect]
434-
/// useful for having a cut-out overlay for example. these [Rect]
435-
/// coordinates are relative to the widget size, so by how much your
436-
/// rectangle overlays the actual image can depend on things like the
437-
/// [BoxFit]
438-
final Rect? scanWindow;
419+
/// Only set this to true if you are starting another instance of mobile_scanner
420+
/// right after disposing the first one, like in a PageView.
421+
///
422+
/// Default: false
423+
final bool? startDelay;
439424
440-
/// Only set this to true if you are starting another instance of mobile_scanner
441-
/// right after disposing the first one, like in a PageView.
442-
///
443-
/// Default: false
444-
final bool? startDelay;
425+
/// Appbar widget
426+
/// you can use this to add appbar to the scanner screen
427+
///
428+
final PreferredSizeWidget? appBar;
445429
446430
```
447431

0 commit comments

Comments
 (0)