requestScreenOrientation method

  1. @override
Future<void> requestScreenOrientation({
  1. required ScreenOrientationTypes type,
  2. bool reverse = false,
})
override

Requests the screen orientation to be set to the specified type.

This function requests the device screen orientation to be changed to the specified ScreenOrientationTypes value. The reverse parameter determines whether the orientation change should be reversed (default is false).

Parameters:

  • type (required): A ScreenOrientationTypes value representing the desired screen orientation to be set (e.g., portrait, landscape).
  • reverse (optional): A bool value that indicates whether the orientation change should be reversed. Defaults to false (no reversal).

Returns:

  • A Future<void> that completes when the orientation request is made.

Example Usage:

await requestScreenOrientation(type: ScreenOrientationTypes.portrait); // Set to portrait
await requestScreenOrientation(type: ScreenOrientationTypes.landscape, reverse: true); // Reverse to landscape

This method should be implemented to handle the screen orientation request logic.

Implementation

@override
Future<void> requestScreenOrientation({
  required ScreenOrientationTypes type,
  bool reverse = false,
}) async {
  await ThanPkg.android.app
      .requestOrientation(type: type, isReverse: reverse);
}