Skip to content

Commit d7b8d6c

Browse files
committed
## 0.0.3
- mobile_scanner: ^3.0.0 added - [#25](#25) fixed - [#32](#32) added, Thanks to @Abhinav-Satija
1 parent b59df7a commit d7b8d6c

19 files changed

+646
-192
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/arvindsangwan/.pub-cache/hosted/pub.dartlang.org/mobile_scanner-2.0.0/
2+
mobile_scanner=/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-3.0.0/

.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/arvindsangwan/.pub-cache/hosted/pub.dartlang.org/mobile_scanner-2.0.0/","native_build":true,"dependencies":[]}],"android":[{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dartlang.org/mobile_scanner-2.0.0/","native_build":true,"dependencies":[]}],"macos":[{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dartlang.org/mobile_scanner-2.0.0/","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dartlang.org/mobile_scanner-2.0.0/","dependencies":[]}]},"dependencyGraph":[{"name":"mobile_scanner","dependencies":[]}],"date_created":"2022-11-15 21:44:22.534748","version":"3.3.8"}
1+
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-3.0.0/","native_build":true,"dependencies":[]}],"android":[{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-3.0.0/","native_build":true,"dependencies":[]}],"macos":[{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-3.0.0/","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-3.0.0/","dependencies":[]}]},"dependencyGraph":[{"name":"mobile_scanner","dependencies":[]}],"date_created":"2023-02-22 05:46:22.918759","version":"3.7.1"}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ migrate_working_dir/
2828
.dart_tool/
2929
.packages
3030
build/
31+
.vscode
32+
.vsCode

CHANGELOG.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
1+
## 0.0.3
2+
3+
- mobile_scanner: ^3.0.0 added
4+
- [#25](https://github.com/mohesu/barcode_scanner/issues/25) fixed
5+
- [#32](https://github.com/mohesu/barcode_scanner/issues/32) added, Thanks to @Abhinav-Satija
6+
17
## 0.0.2+1
8+
29
- multi scan bug fixed
310

411
## 0.0.2
12+
513
- Dependency updates
614
- mobile_scanner: ^3.0.0-beta.1
715

816
## 0.0.1+1
917

10-
* Documentation updated
18+
- Documentation updated
1119

1220
## 0.0.1
1321

14-
* Initial release.
15-
* Added a button to turn the LED on and off.
16-
* Added a button to flip the camera.
17-
* Added a hint text.
18-
* Added a barcode validator.
19-
* Added a QR overlay.
22+
- Initial release.
23+
- Added a button to turn the LED on and off.
24+
- Added a button to flip the camera.
25+
- Added a hint text.
26+
- Added a barcode validator.
27+
- Added a QR overlay.

README.md

Lines changed: 86 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
[![pub package](https://img.shields.io/pub/v/ai_barcode_scanner.svg)](https://pub.dev/packages/ai_barcode_scanner)
44

5-
A universal AI barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS.
5+
AI barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS based on [mobile_scanner](https://pub.dev/packages/mobile_scanner).
6+
7+
## Platform Support
8+
9+
| Android | iOS | macOS | Web | Linux | Windows |
10+
| ------- | --- | ----- | --- | ----- | ------- |
11+
||||| :x: | :x: |
612

713
<table>
814
<tr>
@@ -15,14 +21,14 @@ A universal AI barcode and QR code scanner for Flutter based on MLKit. Uses Came
1521
</tr>
1622
</table>
1723

18-
### Note:
24+
### Note:
25+
1926
_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)._
2027

2128
_I recommend you to read the [mobile_scanner](https://pub.dev/packages/mobile_scanner) plugin's documentation._
2229

23-
24-
2530
### Android
31+
2632
SDK 21 and newer. Reason: CameraX requires at least SDK 21.
2733
Also, make sure you upgrade kotlin to the latest version in your project.
2834

@@ -33,6 +39,7 @@ To use this version you must alter the ai_barcode_scanner gradle file to replace
3339
[You can read more about the difference between the two versions here.](https://developers.google.com/ml-kit/vision/barcode-scanning/android)
3440

3541
### iOS
42+
3643
iOS 11 and newer. Reason: MLKit for iOS requires at least iOS 10 and a [64bit device](https://developers.google.com/ml-kit/migration/ios).
3744

3845
**Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:**
@@ -44,9 +51,11 @@ NSCameraUsageDescription - describe why your app needs access to the camera. Thi
4451
NSPhotoLibraryUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.
4552

4653
### macOS
54+
4755
macOS 10.13 or newer. Reason: Apple Vision library.
4856

4957
### Web
58+
5059
Add this to `web/index.html`:
5160

5261
```html
@@ -63,7 +72,7 @@ Import `package:ai_barcode_scanner/ai_barcode_scanner.dart`, and use the widget
6372
If you don't provide a controller, you can't control functions like the torch(flash) or switching camera.
6473

6574
If you don't set allowDuplicates to false, you can get multiple scans in a very short time, causing things like pop() to fire lots of times.
66-
75+
6776
```dart
6877
import 'package:ai_barcode_scanner/ai_barcode_scanner.dart';
6978
@@ -94,21 +103,58 @@ AiBarcodeScanner(
94103
),
95104
```
96105

106+
### BarcodeCapture
107+
108+
The onDetect function returns a BarcodeCapture objects which contains the following items.
109+
110+
| Property name | Type | Description |
111+
| ------------- | ------------- | --------------------------------- |
112+
| barcodes | List<Barcode> | A list with scanned barcodes. |
113+
| image | Uint8List? | If enabled, an image of the scan. |
114+
115+
You can use the following properties of the Barcode object.
116+
117+
| Property name | Type | Description |
118+
| ------------- | -------------- | ----------------------------------- |
119+
| format | BarcodeFormat | |
120+
| rawBytes | Uint8List? | binary scan result |
121+
| rawValue | String? | Value if barcode is in UTF-8 format |
122+
| displayValue | String? | |
123+
| type | BarcodeType | |
124+
| calendarEvent | CalendarEvent? | |
125+
| contactInfo | ContactInfo? | |
126+
| driverLicense | DriverLicense? | |
127+
| email | Email? | |
128+
| geoPoint | GeoPoint? | |
129+
| phone | Phone? | |
130+
| sms | SMS? | |
131+
| url | UrlBookmark? | |
132+
| wifi | WiFi? | WiFi Access-Point details |
133+
134+
## Thanks to
135+
136+
The [mobile_scanner](https://pub.dev/packages/mobile_scanner) plugin by [steenbakker.dev](https://pub.dev/publishers/steenbakker.dev/packages).
137+
138+
This package depends on [mobile_scanner](https://pub.dev/packages/mobile_scanner)
139+
140+
I recommend you to read the [mobile_scanner](https://pub.dev/packages/mobile_scanner) plugin's documentation.
141+
97142
### Parameters of the widget
98143

99144
```dart
100145
/// Function that gets Called when barcode is scanned successfully
146+
///
101147
final void Function(String) onScan;
102148
103149
/// Function that gets called when a Barcode is detected.
104150
///
105151
/// [barcode] The barcode object with all information about the scanned code.
106152
/// [args] Information about the state of the MobileScanner widget
107-
final Function(Barcode barcode, MobileScannerArguments? args)? onDetect;
153+
final void Function(BarcodeCapture)? onDetect;
108154
109155
/// Validate barcode text with [ValidateType]
110156
/// [validateText] and [validateType] must be set together.
111-
final String? validateText;
157+
final String validateText;
112158
113159
/// Validate type [ValidateType]
114160
/// Validator working with single string value only.
@@ -153,8 +199,10 @@ AiBarcodeScanner(
153199
/// Overlay cut out size (default: 300)
154200
final double cutOutSize;
155201
156-
/// Show hint or not (default: true)
157-
final bool showHint;
202+
/// Hint widget (optional) (default: Text('Scan QR Code'))
203+
/// Hint widget will be replaced the bottom of the screen.
204+
/// If you want to replace the bottom screen widget, use [hintWidget]
205+
final Widget? hintWidget;
158206
159207
/// Hint text (default: 'Scan QR Code')
160208
final String hintText;
@@ -191,9 +239,34 @@ AiBarcodeScanner(
191239
192240
/// Can auto back to previous page when barcode is successfully scanned (default: true)
193241
final bool canPop;
194-
```
195242
196-
## Thanks to
197-
The [mobile_scanner](https://pub.dev/packages/mobile_scanner) plugin by [steenbakker.dev](https://pub.dev/publishers/steenbakker.dev/packages).
243+
/// The function that builds an error widget when the scanner
244+
/// could not be started.
245+
///
246+
/// If this is null, defaults to a black [ColoredBox]
247+
/// with a centered white [Icons.error] icon.
248+
final Widget Function(BuildContext, MobileScannerException, Widget?)?
249+
errorBuilder;
198250
199-
I recommend you to read the [mobile_scanner](https://pub.dev/packages/mobile_scanner) plugin's documentation.
251+
/// The function that builds a placeholder widget when the scanner
252+
/// is not yet displaying its camera preview.
253+
///
254+
/// If this is null, a black [ColoredBox] is used as placeholder.
255+
final Widget Function(BuildContext, Widget?)? placeholderBuilder;
256+
257+
///The function that signals when the barcode scanner is started.
258+
final void Function(MobileScannerArguments?)? onScannerStarted;
259+
260+
/// if set barcodes will only be scanned if they fall within this [Rect]
261+
/// useful for having a cut-out overlay for example. these [Rect]
262+
/// coordinates are relative to the widget size, so by how much your
263+
/// rectangle overlays the actual image can depend on things like the
264+
/// [BoxFit]
265+
final Rect? scanWindow;
266+
267+
/// Only set this to true if you are starting another instance of mobile_scanner
268+
/// right after disposing the first one, like in a PageView.
269+
///
270+
/// Default: false
271+
final bool? startDelay;
272+
```

example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>9.0</string>
24+
<string>11.0</string>
2525
</dict>
2626
</plist>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"authors": "Google, Inc.",
3+
"dependencies": {
4+
"GTMSessionFetcher/Core": [
5+
"~> 2.1"
6+
],
7+
"GoogleDataTransport": [
8+
"~> 9.0"
9+
],
10+
"GoogleToolboxForMac/Logger": [
11+
"~> 2.1"
12+
],
13+
"GoogleToolboxForMac/NSData+zlib": [
14+
"~> 2.1"
15+
],
16+
"GoogleToolboxForMac/NSDictionary+URLArguments": [
17+
"~> 2.1"
18+
],
19+
"GoogleUtilities/UserDefaults": [
20+
"~> 7.0"
21+
],
22+
"GoogleUtilitiesComponents": [
23+
"~> 1.0"
24+
],
25+
"Protobuf": [
26+
"~> 3.12"
27+
]
28+
},
29+
"description": "This is a top level pod containing common elements for all the ML Kit pods, including APIs for managing models.",
30+
"frameworks": [
31+
"Foundation",
32+
"LocalAuthentication"
33+
],
34+
"homepage": "https://developers.google.com/ml-kit/guides",
35+
"libraries": [
36+
"c++",
37+
"sqlite3",
38+
"z"
39+
],
40+
"license": {
41+
"text": "Copyright 2022 Google",
42+
"type": "Copyright"
43+
},
44+
"module_name": "MLKitCommon",
45+
"name": "MLKitCommon",
46+
"platforms": {
47+
"ios": "10.0"
48+
},
49+
"pod_target_xcconfig": {
50+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]": "arm64"
51+
},
52+
"preserve_paths": [
53+
"CHANGELOG.md",
54+
"README.md",
55+
"NOTICES"
56+
],
57+
"source": {
58+
"http": "https://dl.google.com/dl/cpdc/127d68bf72709c34/MLKitCommon-8.0.0.tar.gz"
59+
},
60+
"summary": "ML Kit Common SDK for iOS",
61+
"user_target_xcconfig": {
62+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]": "arm64"
63+
},
64+
"vendored_frameworks": [
65+
"Frameworks/MLKitCommon.framework"
66+
],
67+
"version": "8.0.0"
68+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"authors": "Google, Inc.",
3+
"dependencies": {
4+
"GTMSessionFetcher/Core": [
5+
"~> 2.1"
6+
],
7+
"GoogleToolboxForMac/Logger": [
8+
"~> 2.1"
9+
],
10+
"GoogleToolboxForMac/NSData+zlib": [
11+
"~> 2.1"
12+
],
13+
"MLImage": [
14+
" 1.0.0-beta3"
15+
],
16+
"MLKitCommon": "~> 8.0",
17+
"Protobuf": [
18+
"~> 3.12"
19+
]
20+
},
21+
"description": "This is the top level pod for ML Kit for vision based features on iOS. ML Kit is a mobile SDK that brings Google's machine learning expertise to mobile devices in a powerful yet easy-to-use package.",
22+
"frameworks": [
23+
"Accelerate",
24+
"AVFoundation",
25+
"CoreGraphics",
26+
"CoreMedia",
27+
"CoreVideo",
28+
"Foundation",
29+
"UIKit"
30+
],
31+
"homepage": "https://developers.google.com/ml-kit/guides",
32+
"license": {
33+
"text": "Copyright 2022 Google",
34+
"type": "Copyright"
35+
},
36+
"module_name": "MLKitVision",
37+
"name": "MLKitVision",
38+
"platforms": {
39+
"ios": "10.0"
40+
},
41+
"pod_target_xcconfig": {
42+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]": "arm64"
43+
},
44+
"preserve_paths": [
45+
"CHANGELOG.md",
46+
"README.md",
47+
"NOTICES"
48+
],
49+
"source": {
50+
"http": "https://dl.google.com/dl/cpdc/cdb0c0b1b268d456/MLKitVision-4.2.0.tar.gz"
51+
},
52+
"summary": "ML Kit Vision SDK for iOS",
53+
"user_target_xcconfig": {
54+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]": "arm64"
55+
},
56+
"vendored_frameworks": [
57+
"Frameworks/MLKitVision.framework"
58+
],
59+
"version": "4.2.0"
60+
}

example/ios/Podfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
platform :ios, '11.0'
2+
platform :ios, '12.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
@@ -30,6 +30,8 @@ flutter_ios_podfile_setup
3030
target 'Runner' do
3131
use_frameworks!
3232
use_modular_headers!
33+
pod 'MLKitVision', :podspec => 'MLKitVision.podspec.json'
34+
pod 'MLKitCommon', :podspec => 'MLKitCommon.podspec.json'
3335

3436
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3537
end

0 commit comments

Comments
 (0)