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
* 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 |
## Features
- [x] Scan barcode from camera stream
- [x] Scan barcode from image path or url
- [x] Create barcode from text
- [ ] Read multiple barcodes from camera or gallery
- [ ] Return scanned barcode position and size
- Scan barcode from camera stream
- Scan barcode from image path or url
- Create barcode from text
- Flashlight and pinch to zoom support
## Todo
- Read multiple barcodes from camera or gallery
- Return scanned barcode position and size
## Getting Started
### To read barcode:
@ -42,15 +45,25 @@ Widget build(BuildContext context) {
),
);
// Or use FlutterZxing to read barcode from camera image directly
cameraController?.startImageStream((img) async {
final bytes = await convertImage(img);
final result = FlutterZxing.readBarcode(bytes, Format.Any, img.width, img.height, 200, 200);
// Or use FlutterZxing
// To read barcode from camera image directly
cameraController?.startImageStream((image) async {
CodeResult result = await FlutterZxing.processCameraImage(image);
if (result.isValidBool) {
debugPrint(result.textString);
}
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:

4
lib/flutter_zxing.dart

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

4
lib/reader_widget.dart

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

2
pubspec.yaml

@ -1,6 +1,6 @@
name: flutter_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
environment:

Loading…
Cancel
Save