khoren93 / flutter_zxing

Flutter plugin for scanning and generating QR codes using the ZXing library, supporting Android, iOS, and desktop platforms
https://pub.dev/packages/flutter_zxing
MIT License
92 stars 52 forks source link

ReaderWidget does not scan anything on iPad #24

Closed kaboc closed 1 year ago

kaboc commented 2 years ago

I'm really impressed that it works really stable on Android. I don't have any issues that I had with other similar packages. It's great.

However, I tried it next on my iPad and found that the same code wouldn't work. Are you aware of the issue that onScan is never called on iPadOS? I have no idea if the same thing also happens on iOS because I don't have an iPhone.

It appears that it's only an issue of scanning.

Just FYI, a message "setFlashModeFailed: Devide does not have flash capabilities" is printed in the console when the camera is ready, although I don't think this has anything to do with the issue.

khoren93 commented 2 years ago

Hi @kaboc Thank you for an issue report. I did not have such a problem, I tested on iPad Pro 11 and iPad Pro 9,7 and everything works fine. Can you please try scanning from an image and tell me if it works?

kaboc commented 2 years ago

The same QR code as the one that wasn't scanned with ReaderWidget was successfully scanned using the processCameraImage() method in startImageStream() on the CameraController obtained with onControllerCreated.

Another QR code was scanned with readBarcodeImageUrl() too.

Hope this gives you a clue.

kaboc commented 2 years ago

My environment

LinHaoLove commented 2 years ago

Yes, I have the same problem. Flutter: 3.0.5 iPad Air ==>iOS 12.5.5 (16H62) iPad mini 3 ==>iOS 12.5.5 (16H62) iPad mini 5 ==>iOS 15.6 (19G71)

I just only use the ReaderWidget. I don't know how to refer to CameraController.

khoren93 commented 2 years ago

@LinHaoLove to refer to CameraController you can use onControllerCreated property like this

ReaderWidget(
    onScan: (CodeResult result) {
      // do something with the result
    },
    onControllerCreated: (controller) {
      // do something with the controller
    },
)
khoren93 commented 1 year ago

Fixed in v1.0.1