Closed fulstadev closed 1 week ago
I will have to investigate why this is happening. Do you have a sample barcode that has a size on iOS ?
@navaronbracke Thanks that would be great! For us, it happened for pretty much every classic QR-Code that holds a URL / TOTP-URL in black and white, on a white background (I'm not allowed to share these here). But it seems to happen with any basic QR-Code (I've attached an example with which the above-mentioned happened; works on iOS, size is always empty on android). The value of the QR-Code is the URL https://www.google.com
(generated via https://www.qrcode-monkey.com
).
.
Thanks for the example, I'll investigate this bug!
@navaronbracke do you have any news, or know when this could be fixed? Or a possible workaround for the meantime that you could recommend?
I didn't have time to dive into this much yet, although I do see that we pass the raw data from MLKit back to Dart. So perhaps there is no data from MLKit or we do not properly parse the data that we get back. I will only be able to fix the bug if it is the latter situation, though.
Alright thanks for the info. Curious to see what's the reason, as this is unfortunately currently preventing our release. If you cannot fix it please let me know too, then I'll probably just omit the size check on Android.
@fulstadev Okay, so it seems we don't pass the bounding box (which is a nullable Rect) to https://github.com/juliansteenbakker/mobile_scanner/blob/master/android/src/main/kotlin/dev/steenbakker/mobile_scanner/MobileScannerUtilities.kt#L29-L37 which is an extension on the Android MLKit Barcode class. We use that extension to get a Map<String, Any?> to pass to Dart. I checked the remaining properties of the MLKit Barcode class on Android and it was the only one we missed.
Should be an easy bugfix, so you can expect this to be released today, once I tested it :)
@navaronbracke Excellent News, thank you so much mate!
@fulstadev With the new fix, I will be adding a new size
property to Barcode
(which is the size of the barcode bounding box). You are going to want to use that from now on.
The BarcodeCapture.size
attribute is the size of the capture input image from the camera. I also updated the documentation for that property, to make it less confusing.
@fulstadev If you want to, feel free to do a code review on the linked PR and/or test the fix on your end. (using a git dependency) https://dart.dev/tools/pub/dependencies#git-packages
I'll try to test this today, but this should help you out in the interim.
@fulstadev This is included in version 5.2.2
@fulstadev Small follow-up question, do you want the size and corners on MacOS also? At first I wasn't sure if the result from the Vision API (which we use for MacOS) contained that information. However, the corner points (and by extension the size of the barcode) are available there.
@navaronbracke Cheers mate! Sorry was not able to get back on this so far, will implement and test it now! And no thanks, no need for a macOS implementation, at least nor for us.
No worries! I'll be adding the MacOS (and web) size information in another update. For those platforms, we can use the normalized size from the corner points.
I've setup the following widget to use it as QR-Code Scanner Screen:
Only on physical android devices (both a modern and an older one), the screen is never left. That's why I've added the many print statements in the code, and indeed, for android only,
barcoeCapture.size.isEmpty
is alwaystrue
, so the screen is never exit on Android phones. A sample output of all the print statements is:on iOS, no problem at all.
Any idea why this could be happening?
Version we're using:
mobile_scanner: ^5.1.1
flutter doctor output: