Browse Source

version: 0.3.0

pull/3/head
Khoren Markosyan 3 years ago
parent
commit
9e529de765
  1. 7
      CHANGELOG.md
  2. 31
      README.md
  3. 4
      lib/flutter_zxing.dart
  4. 4
      lib/reader_widget.dart
  5. 2
      pubspec.yaml

7
CHANGELOG.md

@ -1,3 +1,10 @@
## 0.3.0
* added processCameraImage function
* added pinch to zoom sopport
* added flash sopport
* added custom scanner overlay support
## 0.2.0 ## 0.2.0
* added 'readImagePath' function * added 'readImagePath' function

31
README.md

@ -19,11 +19,14 @@ A barcode and QR code scanner based on [ZXing C++](https://github.com/nu-book/zx
| | DataBar Expanded | | | DataBar Expanded |
## Features ## Features
- [x] Scan barcode from camera stream - Scan barcode from camera stream
- [x] Scan barcode from image path or url - Scan barcode from image path or url
- [x] Create barcode from text - Create barcode from text
- [ ] Read multiple barcodes from camera or gallery - Flashlight and pinch to zoom support
- [ ] Return scanned barcode position and size
## Todo
- Read multiple barcodes from camera or gallery
- Return scanned barcode position and size
## Getting Started ## Getting Started
### To read barcode: ### To read barcode:
@ -42,15 +45,25 @@ Widget build(BuildContext context) {
), ),
); );
// Or use FlutterZxing to read barcode from camera image directly // Or use FlutterZxing
cameraController?.startImageStream((img) async { // To read barcode from camera image directly
final bytes = await convertImage(img); cameraController?.startImageStream((image) async {
final result = FlutterZxing.readBarcode(bytes, Format.Any, img.width, img.height, 200, 200); CodeResult result = await FlutterZxing.processCameraImage(image);
if (result.isValidBool) { if (result.isValidBool) {
debugPrint(result.textString); debugPrint(result.textString);
} }
return null; return null;
}); });
// To read barcode from XFile, String or url
XFile xFile = XFile('Your image path');
CodeResult? resultFromXFile = await FlutterZxing.readImagePath(xFile);
String path = 'Your image path';
CodeResult? resultFromPath = await FlutterZxing.readImagePathString(path);
String url = 'Your image url';
CodeResult? resultFromUrl = await FlutterZxing.readImageUrl(url);
``` ```
### To create barcode: ### To create barcode:

4
lib/flutter_zxing.dart

@ -129,8 +129,8 @@ class FlutterZxing {
return result; return result;
} }
static Future<CodeResult> processCameraImage( static Future<CodeResult> processCameraImage(CameraImage image,
CameraImage image, int format, double cropPercent) async { {int format = Format.Any, double cropPercent = 0.5}) async {
var isolateData = IsolateData(image, format, cropPercent); var isolateData = IsolateData(image, format, cropPercent);
CodeResult result = await _inference(isolateData); CodeResult result = await _inference(isolateData);
return result; return result;

4
lib/reader_widget.dart

@ -152,8 +152,8 @@ class _ReaderWidgetState extends State<ReaderWidget>
try { try {
CodeResult result = await FlutterZxing.processCameraImage( CodeResult result = await FlutterZxing.processCameraImage(
image, image,
widget.codeFormat, format: widget.codeFormat,
widget.cropPercent, cropPercent: widget.cropPercent,
); );
if (result.isValidBool) { if (result.isValidBool) {
if (widget.beep) { if (widget.beep) {

2
pubspec.yaml

@ -1,6 +1,6 @@
name: flutter_zxing name: flutter_zxing
description: A barcode scanner and generator natively in Flutter with Dart FFI based on ZXing. description: A barcode scanner and generator natively in Flutter with Dart FFI based on ZXing.
version: 0.2.0 version: 0.3.0
repository: https://github.com/khoren93/flutter_zxing repository: https://github.com/khoren93/flutter_zxing
environment: environment:

Loading…
Cancel
Save