juliansteenbakker / mobile_scanner

A universal scanner for Flutter based on MLKit. Uses CameraX on Android and AVFoundation on iOS.
BSD 3-Clause "New" or "Revised" License
897 stars 514 forks source link

Wrong Camera Orientation in Landscape mode #656

Open HasanShaddadKangaroo opened 1 year ago

HasanShaddadKangaroo commented 1 year ago

I have added the library to my app which only runs in Landscape mode and for a reason the camera orientation in the Library seems to be fixed and wrong. As you can see in the below screenshot. Plus the same issue occurred with example application.

Flutter information: [✓] Flutter (Channel stable, 3.7.9, on macOS 13.3.1 22E772610a darwin-arm64, locale en-US) • Flutter version 3.7.9 on channel stable at X • Upstream repository https://github.com/flutter/flutter.git • Framework revision 62bd79521d (9 weeks ago), 2023-03-30 10:59:36 -0700 • Engine revision ec975089ac • Dart version 2.19.6 • DevTools version 2.20.1

Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/hassanshaddad/Library/Android/sdk • Platform android-33, build-tools 33.0.2 • ANDROID_HOME = /Users/hassanshaddad/Library/Android/sdk • ANDROID_SDK_ROOT = /Users/hassanshaddad/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14B47b • CocoaPods version 1.12.0

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] IntelliJ IDEA Community Edition (version 2022.3.3) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 73.0.3 • Dart plugin version 223.8888

[✓] Connected device (4 available) • SM T290 (mobile) • R9WNB0W8G2J • android-arm64 • Android 11 (API 30) • iPhone 14 Pro Max (mobile) • 3E00C8A2-4879-4D6B-A371-2AE5AF307552 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-1 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E772610a darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.90

[✓] HTTP Host Availability • All required HTTP hosts are available

• No issues found!

Device:

Device: Galaxy Tab A 2010 OS: Android 11

Screenshots:

Screenshot_20230604-143138

Any idea how that can be handled?

BBQRIBS72 commented 1 year ago

This is related to this discussion (https://github.com/juliansteenbakker/mobile_scanner/discussions/17).

There is a suggestion there to use a RotatedBox or Transform.rotate widget that you can try but it's not perfect. I'm also having similar issues with orientation currently.

mregnauld commented 1 year ago

I have the same problem...

HasanShaddadKangaroo commented 1 year ago

@BBQRIBS72 True I had to enclose the MobileScanner widget in a RotatedBox widget with quarterTurns of 3. That made the trick but still not a perfect fix/solution. @mregnauld you can try this workaround for the time being.

EArminjon commented 1 year ago

As I know it only happen in debug not in release.

mregnauld commented 1 year ago

As I know it only happen in debug not in release.

For your information, I just tested in release and I still have the issue.

I'll try the RotatedBox workaround.

phanbaohuy96 commented 1 year ago

PR is ready to fix this issue on android #670

docbee-fschrader commented 1 year ago

The issue seems to still exist. Tested on a Galaxy A52s with Android 13 using the example app Screenshot_20231110_155416

magic3584 commented 12 months ago

This issue also exists in version 3.5.2.

Tr2e commented 10 months ago

iPad also has this problem (iPad 7th gen, iPad OS 15.7)