Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken QR codes due to style position error. #194

Open
AdrienLemaire opened this issue Nov 8, 2022 · 5 comments
Open

Broken QR codes due to style position error. #194

AdrienLemaire opened this issue Nov 8, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@AdrienLemaire
Copy link

AdrienLemaire commented Nov 8, 2022

Describe the bug
The corners' inner squares aren't always aligned, which breaks the QR code (unscannable).
I can only reproduce the bug on a mobile chrome web browser (which is the target we focus on), seems to always work fine on a chrome desktop (I can still reproduce using the debugger device toolbox to simulate a mobile device from desktop).

Seems related to #182

Expected behavior
The inner squares should be properly centered

Screenshots
Identical page, different position mode:

Portrait (broken):

Landscape (working):

Desktop (please complete the following information):

  • Browser [e.g. chrome, safari] Chrome
  • Version [e.g. 22]: 107

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] Pixel 6
  • OS: [e.g. iOS8.1] Android 13
  • Browser [e.g. stock browser, safari] Chrome
  • Version [e.g. 22] 107

Additional context
Seems to be a styling issue, but I don't know how to debug this kind of error.
Untitled

@AdrienLemaire AdrienLemaire added the bug Something isn't working label Nov 8, 2022
@AdrienLemaire
Copy link
Author

AdrienLemaire commented Nov 8, 2022

After trying to debug this issue further, I understand that canvas.drawRRect receives the exact same values to place the eyes, but when the device type is "mobile", the outerRect will have a wrong left & top offset added.
Changing the DPR doesn't have any effect, but for the same viewport, changing the device type has an effect ("desktop" works, "mobile" breaks).

Values passed to Rect.fromLTWH in both cases

*** Drawing square eye
outerRect: 8, 8, 57, 57
innerRect: 17.5, 17.5, 38, 38
dotRect: 22.25, 22.25, 28.5, 28.5
*** Drawing square eye
outerRect: 8, 255, 57, 57
innerRect: 17.5, 264.5, 38, 38
dotRect: 22.25, 269.25, 28.5, 28.5
*** Drawing square eye
outerRect: 255, 8, 57, 57
innerRect: 264.5, 17.5, 38, 38
dotRect: 269.25, 22.25, 28.5, 28.5

mobile:

desktop:

@AdrienLemaire
Copy link
Author

2nd insight: This could be a Chrome-specific bug. Opening the page in a webview (for example, by scanning the QR code and navigate to that website) works fine (creating a QR code will diplay the eyes properly).

@AdrienLemaire
Copy link
Author

pinging the authors for help:
@lukef @kevmoo @romkor @Cretezy @kelegorm @pedromassango @lukepighetti @jonas-zebari

@kevmoo
Copy link

kevmoo commented Nov 12, 2022

I THINK this is due to drawing logic. Put in the same input here: https://kevmoo.github.io/qr.dart/ - which uses browser APIs (Dart, but not flutter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants