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

2
example/pubspec.lock

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

14
lib/src/logic/barcode_encoder.dart

@ -2,13 +2,13 @@ part of 'zxing.dart';
// Encode a string into a barcode // Encode a string into a barcode
EncodeResult encodeBarcode( EncodeResult encodeBarcode(
String contents, String contents, {
int width, int format = Format.QRCode,
int height, int width = 300,
int format, int height = 300,
int margin, int margin = 0,
int eccLevel, int eccLevel = 0,
) { }) {
return bindings.encodeBarcode( return bindings.encodeBarcode(
contents.toNativeUtf8().cast<Char>(), contents.toNativeUtf8().cast<Char>(),
width, 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 height = int.parse(_heightController.value.text);
final int margin = int.parse(_marginController.value.text); final int margin = int.parse(_marginController.value.text);
final int ecc = int.parse(_eccController.value.text); final int ecc = int.parse(_eccController.value.text);
final EncodeResult result = final EncodeResult result = encodeBarcode(
encodeBarcode(text, width, height, _codeFormat, margin, ecc); text,
format: _codeFormat,
width: width,
height: height,
margin: margin,
eccLevel: ecc,
);
String? error; String? error;
if (result.isValidBool) { if (result.isValidBool) {
try { try {

2
pubspec.yaml

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

16
zxscanner/pubspec.lock

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

2
zxscanner/pubspec.yaml

@ -43,7 +43,7 @@ dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
hive_generator: 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: # integration_test:
# sdk: flutter # sdk: flutter
mobx_codegen: mobx_codegen:

Loading…
Cancel
Save