switchLayoutOrientation method
Implementation
Future<void> switchLayoutOrientation({BuildContext? context}) async {
if (_rootContext == null && context == null) {
TCICLog.error(
"rootContext is null",
actionModule: ActionModule.tcicController.name,
actionName: ActionName.switchLayoutOrientation.name,
);
return;
}
final isPortrait =
context == null
? MediaQuery.of(_rootContext!).orientation == Orientation.portrait
: MediaQuery.of(context).orientation == Orientation.portrait;
if (isPortrait) {
await setLayoutOrientation(LayoutOrientation.landscape);
} else {
await setLayoutOrientation(LayoutOrientation.portrait);
}
}