device_orientation_for_x 0.0.2 copy "device_orientation_for_x: ^0.0.2" to clipboard
device_orientation_for_x: ^0.0.2 copied to clipboard

Check how the device is rotated even if system rotation is disabled and make sure widgets are always pointing down.

Device orientation for x #

Absolute device orientation readings based on accelerometer events.

Use to rotate certain widgets when user rotates the device without handling complex responsiveness.

device orientation demo

Usage #

Note: On devices that does not have or support sensors orientation will default to DeviceOrientation.portraitUp.

Listen to a device orientation stream:

deviceOrientation$.listen((orientation) { 
  print(orientation); 
});

Do some work based on current device orientation:

if (deviceOrientation == DeviceOrientation.portraitUp) {
  // ...
}

Use helper widget to make sure that user always sees critical widgets in correct orientation:

AnimatedAlwaysDown(
  child: Text("I'm readable!")
)

If you does not need animation use:

AlwaysDown(
  child: Text("I'm readable!")
)
0
likes
130
points
29
downloads

Publisher

unverified uploader

Weekly Downloads

Check how the device is rotated even if system rotation is disabled and make sure widgets are always pointing down.

Repository (GitLab)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, sensors_plus

More

Packages that depend on device_orientation_for_x