Skip to content

OrientationUtils

Dan M edited this page Mar 31, 2022 · 2 revisions

OrientationUtils is a wrapper for Native Device Orientation. It allows you to easily access the current orientation of the device.

initOrientation needs to be called before it will work.


API

Enums

EOrientation

Each EOrientation represents a different device orientation.

Value Orientation
portraitUp The device is upright
portraitDown The device is upside down
landscapeLeft The device is on its' side and facing left
landscapeRight The device is on its' side and facing right
unknown The device orientation could not be found

Static Methods

static void disableColors()

Disables the colors for the static Log object.

static void initOrientation({bool useSensor})

Starts the listener for the device orientation.

Static Fields

static void Function(EOrientation orientation) onOrientationChange

The callback called when the device orientation of the device changes, assuming initOrientation has been called.

Static Getters

static EOrientation get orientation

Returns the current EOrientation of the device. If initOrientation has not been called, this will be EOrientation.unknown.

Clone this wiki locally