rmtmckenzie / flutter_native_device_orientation

Native device orientation plugin for flutter.
MIT License
76 stars 63 forks source link

Support for detecting portrait lock orientation #52

Open JacobSchantz opened 1 year ago

JacobSchantz commented 1 year ago

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.

caleb654 commented 1 year ago

Yes this is definitely needed!

UlasKasim-dusyeri commented 1 year ago

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

Andrewngabriel commented 1 year ago

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!