defaultEnterNativeFullscreen function

Future<void> defaultEnterNativeFullscreen()

Makes the native window enter fullscreen.

Implementation

Future<void> defaultEnterNativeFullscreen() async {
  try {
    if (Platform.isAndroid || Platform.isIOS) {
      await Future.wait(
        [
          SystemChrome.setEnabledSystemUIMode(
            SystemUiMode.immersiveSticky,
            overlays: [],
          ),
          SystemChrome.setPreferredOrientations(
            [
              DeviceOrientation.landscapeLeft,
              DeviceOrientation.landscapeRight,
            ],
          ),
        ],
      );
    } else if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
      // await const MethodChannel('com.alexmercerind/media_kit_video')
      //     .invokeMethod(
      //   'Utils.EnterNativeFullscreen',
      // );
      await windowManager.ensureInitialized();

      await windowManager.setFullScreen(true);
    }
  } catch (exception, stacktrace) {
    debugPrint(exception.toString());
    debugPrint(stacktrace.toString());
  }
}