flutter_native_device_orientation icon indicating copy to clipboard operation
flutter_native_device_orientation copied to clipboard

Support for detecting portrait lock orientation

Open JacobSchantz opened this issue 3 years ago • 3 comments

Love the package! We've used it to develop a video player and it works like a charm! I think the only thing this package lacks is the ability to detect if the user has portrait orientation lock on or off. This would really complete the package and allow us to show content to users in a much more attractive way, while also respecting their preferences. Users of this package could implement beautiful custom rotation animations to individual widgets, instead of the glitchy-looking default rotation behavior when using systemChrome.

JacobSchantz avatar Nov 21 '22 22:11 JacobSchantz

Yes this is definitely needed!

caleb654 avatar Nov 21 '22 23:11 caleb654

https://pub.dev/packages/auto_rotate_get package supports portrait lock orientation listener but only Android side. iOS side doesn't work. It would be huge if this package provides a solution for it

UlasKasim-dusyeri avatar Nov 28 '22 08:11 UlasKasim-dusyeri

I just created rotation_check which provides a simple API to check whether auto-rotate is turned on or off. The current release works on Android and has a no-op implementation for iOS due to limitations with iOS not providing any public APIs to determine portrait lock mode status.

I've come across some discussions across stackoverflow and forums which give some insight into the possibility of determining whether portrait mode is on/off through accelerometer and gyroscope sensor data. I'm still experimenting with using this approach but I have concerns that it's likely to produce flaky results that are not deterministic in all scenarios.

If someone has ideas or workarounds, I'm all ears!

Andrewngabriel avatar May 29 '23 02:05 Andrewngabriel