OrientationLocker constructor

const OrientationLocker({
  1. List<DeviceOrientation> permittedOrientations = const [DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight],
  2. List<DeviceOrientation> defaultOrientations = const [DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight, DeviceOrientation.portraitUp, DeviceOrientation.portraitDown],
  3. required Widget child,
  4. Key? key,
})

Creates an orientation locker widget.

Parameters:

  • permittedOrientations: Orientations to allow while active. Defaults to landscape only
  • defaultOrientations: Orientations to restore on dispose. Defaults to all orientations
  • child: The child widget to display

Implementation

const OrientationLocker(
    {this.permittedOrientations = const [
      DeviceOrientation.landscapeLeft,
      DeviceOrientation.landscapeRight
    ],
    this.defaultOrientations = const [
      DeviceOrientation.landscapeLeft,
      DeviceOrientation.landscapeRight,
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown
    ],
    required this.child,
    super.key});