Browse Source

updated pubs and readme

pull/26/head
Khoren Markosyan 2 years ago
parent
commit
87c3343633
  1. 24
      README.md
  2. 2
      example/pubspec.lock
  3. 14
      lib/src/logic/barcode_encoder.dart
  4. 10
      lib/src/ui/writer_widget.dart
  5. 2
      pubspec.yaml
  6. 16
      zxscanner/pubspec.lock
  7. 2
      zxscanner/pubspec.yaml

24
README.md

@ -56,27 +56,27 @@ Widget build(BuildContext context) {
),
);
// Or use FlutterZxing
// Or use flutter_zxing plugin methods
// To read barcode from camera image directly
await FlutterZxing.startCameraProcessing(); // Call this in initState
await startCameraProcessing(); // Call this in initState
cameraController?.startImageStream((image) async {
CodeResult result = await FlutterZxing.processCameraImage(image);
CodeResult result = await processCameraImage(image);
if (result.isValidBool) {
debugPrint(result.textString);
}
return null;
});
FlutterZxing.stopCameraProcessing(); // Call this in dispose
stopCameraProcessing(); // Call this in dispose
// To read barcode from XFile, String or url
XFile xFile = XFile('Your image path');
CodeResult? resultFromXFile = await FlutterZxing.readImagePath(xFile);
CodeResult? resultFromXFile = await readImagePath(xFile);
String path = 'Your image path';
CodeResult? resultFromPath = await FlutterZxing.readImagePathString(path);
CodeResult? resultFromPath = await readImagePathString(path);
String url = 'Your image url';
CodeResult? resultFromUrl = await FlutterZxing.readImageUrl(url);
CodeResult? resultFromUrl = await readImageUrl(url);
```
### To create barcode:
@ -101,8 +101,14 @@ Widget build(BuildContext context) {
);
// Or use FlutterZxing to create barcode directly
final text = 'Text to encode';
final result = FlutterZxing.encodeBarcode(text, 300, 300, Format.QRCode, 10, 0);
final result = encodeBarcode(
'Text to encode',
format: Format.QRCode,
width: 300,
height: 300,
margin: 10,
eccLevel: 0,
);
if (result.isValidBool) {
final img = imglib.Image.fromBytes(width, height, result.bytes);
final encodedBytes = Uint8List.fromList(imglib.encodeJpg(img));

2
example/pubspec.lock

@ -42,7 +42,7 @@ packages:
name: camera_avfoundation
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.8+3"
version: "0.9.8+4"
camera_platform_interface:
dependency: transitive
description:

14
lib/src/logic/barcode_encoder.dart

@ -2,13 +2,13 @@ part of 'zxing.dart';
// Encode a string into a barcode
EncodeResult encodeBarcode(
String contents,
int width,
int height,
int format,
int margin,
int eccLevel,
) {
String contents, {
int format = Format.QRCode,
int width = 300,
int height = 300,
int margin = 0,
int eccLevel = 0,
}) {
return bindings.encodeBarcode(
contents.toNativeUtf8().cast<Char>(),
width,

10
lib/src/ui/writer_widget.dart

@ -187,8 +187,14 @@ class _WriterWidgetState extends State<WriterWidget>
final int height = int.parse(_heightController.value.text);
final int margin = int.parse(_marginController.value.text);
final int ecc = int.parse(_eccController.value.text);
final EncodeResult result =
encodeBarcode(text, width, height, _codeFormat, margin, ecc);
final EncodeResult result = encodeBarcode(
text,
format: _codeFormat,
width: width,
height: height,
margin: margin,
eccLevel: ecc,
);
String? error;
if (result.isValidBool) {
try {

2
pubspec.yaml

@ -38,7 +38,7 @@ ffigen:
- "ios/Classes/src/native_zxing.h"
functions:
exclude:
- resultToCodeResult
- 'resultToCodeResult'
# flutter pub publish --dry-run

16
zxscanner/pubspec.lock

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "45.0.0"
version: "46.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.0"
version: "4.6.0"
archive:
dependency: transitive
description:
@ -98,7 +98,7 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.4.0"
version: "8.4.1"
camera:
dependency: transitive
description:
@ -119,7 +119,7 @@ packages:
name: camera_avfoundation
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.8+3"
version: "0.9.8+4"
camera_platform_interface:
dependency: transitive
description:
@ -238,7 +238,7 @@ packages:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.2"
version: "6.1.4"
fixnum:
dependency: transitive
description:
@ -391,7 +391,7 @@ packages:
name: icons_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "2.0.4"
image:
dependency: "direct main"
description:
@ -559,7 +559,7 @@ packages:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.17"
version: "2.0.19"
path_provider_ios:
dependency: transitive
description:
@ -643,7 +643,7 @@ packages:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
quiver:
dependency: transitive
description:

2
zxscanner/pubspec.yaml

@ -43,7 +43,7 @@ dev_dependencies:
flutter_test:
sdk: flutter
hive_generator:
icons_launcher: ^2.0.3 # flutter pub run icons_launcher:create
icons_launcher: ^2.0.4 # flutter pub run icons_launcher:create
# integration_test:
# sdk: flutter
mobx_codegen:

Loading…
Cancel
Save