rmtmckenzie / flutter_native_device_orientation

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

Property to control the sensibility of the sensors #35

Closed fabianbrandscheid closed 2 years ago

fabianbrandscheid commented 2 years ago

Hi,

when using the NativeOrientationBuilder with useSensor = true, the system already reacts to very fine movements. Minimal movements quickly change the orientation, which can lead to a choppy UI (see video in the appendix --> look at the icons in the appbar and the preview image at the bottom):

https://user-images.githubusercontent.com/38261693/148977674-78eb5e0e-08e1-4cf7-b001-17d6855bd5a9.mov

Would it be possible to add another property here to control how fine the sensors react?

rmtmckenzie commented 2 years ago

I don't think a full-on property is needed at this point, I've just made it so that when the device is close to flat any changes are ignored. If that doesn't do it for you I'd encourage you to submit a pr - the relevant iOS code is in ios/Classes/SensorListener.m