mintware-de / flutter_barcode_reader

A flutter plugin for reading 2D barcodes and QR codes.
MIT License
628 stars 463 forks source link

Rewrite platform communication #185

Closed devtronic closed 4 years ago

devtronic commented 4 years ago

Use this PR to test the new features:

# pubspec.yaml
dependencies:
  barcode_scan:
    git:
      url: https://github.com/mintware-de/flutter_barcode_reader.git
      ref: 51affc97580a765f0fa007c0c7fca311db7b119d

Usage:

Advanced usage

You can pass options to the scan method:


import 'package:barcode_scan/barcode_scan.dart';

void main() async {

  var options = ScanOptions(
    // set the options
  );

  var result = await BarcodeScanner.scan(options: options);

  // ...
}

Supported options

Option Type Description Supported by
strings.cancel String The cancel button text on iOS iOS only
strings.flash_on String The flash on button text iOS + Android
strings.flash_off String The flash off button text iOS + Android
restrictFormat BarcodeFormat[] Restrict the formats which are recognized iOS + Android
useCamera int The index of the camera which is used for scanning (See BarcodeScanner.numberOfCameras) iOS + Android
autoEnableFlash bool Enable the flash when start scanning iOS + Android
android.aspectTolerance double Enable the flash when start scanning Android only
android.useAutoFocus bool Enable the flash when start scanning Android only

Todo:

phcaraujo commented 4 years ago

Error

Sem título

devtronic commented 4 years ago

Please post the content of your pubspec.yaml and pubspec.lock

Skyost commented 4 years ago

When does this pull request will be merged ?

sclausen commented 4 years ago

Does/Could this PR also incorporate the config options to solve #53?

devtronic commented 4 years ago

I'll try to finalize the PR next week.

@sclausen Yes :-)

Skyost commented 4 years ago

Cool !

kw2019ltd commented 4 years ago

hi can we return instead of code (future) to return object which contain the code and type (if its QR or Bar..) and if its barcode to return barcode type (pdf,code128 etc)...

static Future scan({Configuration config}) async => await _channel.invokeMethod('scan', config?.writeToBuffer());

devtronic commented 4 years ago

@kw2019ltd Of course 🙂

ghost commented 4 years ago

Hello,when will 3.x be officially released?

https://pub.dev/packages/barcode_scan#-changelog-tab-

devtronic commented 4 years ago

Tomorrow 🙂

ghost commented 4 years ago

Tomorrow 🙂

you are great !

ghost commented 4 years ago

Will 3.x support the following feature ?


var config = Configuration();
config.cancelText = "Abbrechen"; // Your text for the iOS cancel button 
config.flashOnText = "Blitz an"; // Your text for the Flash On Button
config.flashOffText = "Blitz aus"; // Your text for the Flash Off button
config.restrictFormat.addAll([BarcodeFormat.qr]); // Only scan qr codes

// Camera index. Get it from [BarcodeScanner.numberOfCameras]
config.useCamera = 1;
String barcode = await BarcodeScanner.scan(config: config);
ghost commented 4 years ago

https://pub.dev/packages/barcode_scan#-changelog-tab-

There is still displaying barcode_scan 2.0.1 version on dart pub.

kw2019ltd commented 4 years ago

as mentioned about the PR still not merged to master.

1 comment can you add also barcodeFormat upca,itf

devtronic commented 4 years ago

@ihihihihihihih It's 9:21 AM in Germany, I'll update the update the library today 😉

@kw2019ltd afaik are this types only supported by the iOS scanner library. IMO the package only should provide options which are supported by both platforms iOS and Android.

kw2019ltd commented 4 years ago

good, yes those format are supported by firebase_ml_vision (flutter plugin) for both android and ios.

On Sun, Apr 12, 2020 at 10:23 AM Julian Finkler notifications@github.com wrote:

@ihihihihihihih https://github.com/ihihihihihihih It's 9:21 AM in Germany, I'll update the update the library today 😉

@kw2019ltd https://github.com/kw2019ltd afaik are this types only supported by the iOS scanner library. IMO the package only should provide options which are supported by both platforms iOS and Android.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mintware-de/flutter_barcode_reader/pull/185#issuecomment-612575537, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJEI6X3KIM2WL6USHXRKWLRMFT7FANCNFSM4KZPXMBQ .

sclausen commented 4 years ago

@kw2019ltd Unfortunately this lib doesn’t use firebase_ml_vision, but me.dm7.barcodescanner:zxing for android.

devtronic commented 4 years ago

@sclausen Yes, but I plan to migrate to ML vision since it provides for both iOS and Android the same options.

sclausen commented 4 years ago

Wouldn’t that force developers to have a firebase account for their project to use this library? This seems to be a severe change.

ghost commented 4 years ago

3.0.0-dev.2 has a problem on my Android phone.

The plugin on debug mode is ok.

But on release mode has the following error.

04-13 11:54:05.966 26938 26977 E flutter : [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method requestCameraPermission on channel de.mintware.barcode_scan)
04-13 11:54:05.966 26938 26977 E flutter : #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319)
04-13 11:54:05.966 26938 26977 E flutter : <asynchronous suspension>
04-13 11:54:05.966 26938 26977 E flutter : #1      BarcodeScanner.scan (package:barcode_scan/platform_wrapper.dart:56)
04-13 11:54:05.966 26938 26977 E flutter : #2      _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:45)
04-13 11:54:05.966 26938 26977 E flutter : #3      BarcodeScanner.scan (package:barcode_scan/platform_wrapper.dart:31)
devtronic commented 4 years ago

@ihihihihihihih : Take a look on this: https://github.com/mintware-de/flutter_barcode_reader/issues/211