Closed Plateria closed 4 years ago
I now figured out, that it is possible to read barcodes in landscape mode on the Huawei Mate 8. Though i need it to read barcodes on either portrait, or landscape.
Here is a link to the underlying explanation: https://github.com/dm77/barcodescanner#advanced-usage
@matthewtsmith is there a way to pass arguemnts to the underlying implementation?
@vuchl We would need to add that support to the Dart API and pass it through the plugin channel. I don't currently have the time to add this but it should be a relatively easy feature to add if anyone is willing to take a crack at doing a PR.
Is there some resource for what you are talking about? @matthewtsmith
There is a write up of how to use channels here: https://flutter.io/platform-channels/
My suggestion would be to add a ScanOptions class that gets passed into the scan
method.
https://github.com/apptreesoftware/flutter_barcode_reader/blob/master/lib/barcode_scan.dart
Something like
class ScanOptions {
bool flash;
bool autoFocus;
double aspectTolerance;
}
Then you would modify the scan
method to accept those arguments.
BarcodeScanner.scan(ScanOptions(apsectTolerance: 0.5))
You would read in those options in the Kotlin and Objective-C code which you can see examples of in that guide.
Here are the relevant areas of code to start with in the native code:
ObjC:
the class MethodCall
has arguments
that you can pull out anything you pass into it.
I started a fork and toyed around a bit here: https://github.com/vuchl/flutter_barcode_reader/commits/master
But I have just made the edits in GitHub. I'll see if I can get this to work on PC at home. Unfortunately I can not check the iOS specific stuff and I am not sure if it would actually be needed at all.
When using the BarcodeScanner.scan() method on the Huawai Mate 8, the automatic resolution detection sets the resolution too low, so no barcodes are found. Is there a way to set the resolution manually?