Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

Rewrite platform communication #185

Merged
merged 11 commits into from
Apr 12, 2020
Merged

Conversation

devtronic
Copy link
Member

@devtronic devtronic commented Feb 22, 2020

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:

  • Set camera properties
  • Return the barcode type

- Bump minSdk version up to 18
- Retrieve the number of available cameras with `BarcodeScanner.numberOfCameras`

Flexible configuration:
- Set the strings for the flash on/off and the cancel button
- Restrict the detected barcode formats
- Set which camera is used for scanning barcodes
@devtronic devtronic changed the base branch from master to 3.x February 22, 2020 17:45
@phcaraujo
Copy link

Error

Sem título

@devtronic
Copy link
Member Author

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

@Skyost
Copy link

Skyost commented Apr 1, 2020

When does this pull request will be merged ?

@sclausen
Copy link

sclausen commented Apr 2, 2020

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

@devtronic devtronic linked an issue Apr 2, 2020 that may be closed by this pull request
@devtronic
Copy link
Member Author

I'll try to finalize the PR next week.

@sclausen Yes :-)

@Skyost
Copy link

Skyost commented Apr 2, 2020

Cool !

@kw2019ltd
Copy link

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
Copy link
Member Author

@kw2019ltd Of course 🙂

@devtronic devtronic linked an issue Apr 8, 2020 that may be closed by this pull request
@ghost
Copy link

ghost commented Apr 11, 2020

Hello,when will 3.x be officially released?

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

@devtronic
Copy link
Member Author

Tomorrow 🙂

@ghost
Copy link

ghost commented Apr 11, 2020

Tomorrow 🙂

you are great !

@ghost
Copy link

ghost commented Apr 11, 2020

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);

…into rewrite_platform_communication

# Conflicts:
#	android/src/main/kotlin/de/mintware/barcode_scan/BarcodeScannerActivity.kt
@devtronic devtronic changed the title [WIP] Rewrite platform communication Rewrite platform communication Apr 11, 2020
@ghost
Copy link

ghost commented Apr 12, 2020

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

There is still displaying barcode_scan 2.0.1 version on dart pub.

@kw2019ltd
Copy link

as mentioned about the PR still not merged to master.

1 comment can you add also barcodeFormat upca,itf

@devtronic
Copy link
Member Author

@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
Copy link

kw2019ltd commented Apr 12, 2020 via email

@sclausen
Copy link

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

@devtronic
Copy link
Member Author

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

@devtronic devtronic merged commit 693335f into 3.x Apr 12, 2020
@devtronic devtronic deleted the rewrite_platform_communication branch April 12, 2020 11:56
@sclausen
Copy link

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
Copy link

ghost commented Apr 13, 2020

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
Copy link
Member Author

@ihihihihihihih : Take a look on this: #211

@devtronic devtronic mentioned this pull request Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.