plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[Request]: Expose device orientation events

Open jackd opened this issue 3 years ago • 3 comments

Plugin

sensors_plus

Use case

Device orientation (in world coordinates) is often desired and seems to be implemented for android/ios/web under TYPE_ORIENTATION_VECTOR, CMQuaternion and onDeviceOrientation respectively.

My understanding is these use non-trivial sensor fusion algorithms that are more sophisticated than simply integrating gyroscope measurements.

Related to #764

Proposal

Expose a Stream<DeviceOrientationEvent> orientationEvents.

If it will be considered for acceptance, I could hack up a PR based on other stream implementations, though my experience with android/ios is non-existent.

jackd avatar Aug 23 '22 09:08 jackd

I would like to see this implemented as well. I needed access to TYPE_ORIENTATION_VECTOR and was a bit surprised as to why that sensor is not included in the plugin.

@jackd I would assume that setting up a near identical stream would be sufficient? The only thing you'd have to worry about is mapping the native types to a Dart type but that is just conversion?

navaronbracke avatar Sep 05 '22 13:09 navaronbracke

If one just wants to change the UI, then OrientationBuilder can be handy, but in cases where you don't want to change the UI and just know device orientation, it falls flat. This change should not be very difficult to implement, I'll try my hand at it.

Chinmay-KB avatar Sep 05 '22 18:09 Chinmay-KB