arcticfox1919 / flutter-scankit

Flutter QR code scanning
MIT License
142 stars 46 forks source link

Fix iphoneX scan code crash problem #45

Closed fishofeyes closed 8 months ago

fishofeyes commented 1 year ago

The reason for the crash is that the calculated width and height of cutArea may be less than 0, so only the top and left values ​​are calculated here.

arcticfox1919 commented 1 year ago

@eyesoffish I don't have an iphoneX, so I didn't fix the problem. But unfortunately, there is a problem with your modification, because you did not consider Android!

you can check here

The Rect in Android is different from iOS, so we should consider the commonality between Android and iOS.

Rect(int left, int top, int right, int bottom)

If you are sure that the error is caused by cutArea less than 0, maybe you can add some detection code.