A Flutter widget that forces the device rotates into the set of orientations the application interface can be displayed in.

Features

Force device keep portrait/landscape or what the set of orientations that you want. Support to reset that config after disposing.

Getting started

Keep in mind that the widget will only work once in a top-level container. the descendants will not work.

Usage

Keep portrait orientations

OrientationWidget.portrait(
  child: const PortraitPage(),
)

Keep landscape orientations

OrientationWidget.landscape(
  child: const LandscapePage(),
)

Keep specific orientations

OrientationWidget(
  child: const LandscapeLeftPage(),
  orientations: [DeviceOrientation.landscapeLeft],
)

Then reset to specific orientations, otherwise it allows autoOrientations

OrientationWidget.portrait(
  child: const PortraitPage(),
  then: landscapeOrientations,
),

Additional information

Feel free to give feedbacks or report issues. Thank you!

Libraries

orientation_widget