setFullScreen method

void setFullScreen(
  1. bool fullscreen,
  2. BuildContext context
)

Sets the full-screen mode of the application window.

If the fullscreen parameter is true, sets the full-screen mode of the application window to true. Otherwise, sets the full-screen mode to false and exits the full-screen mode if necessary.

Parameters:

  • fullscreen: A boolean indicating whether the application window should be in full-screen mode.
  • context: A BuildContext object used to access the current widget tree context.

Implementation

void setFullScreen(bool fullscreen, BuildContext context) {
  if (fullscreen) {
    goToFullscreen(context);
  } else {
    if (launchedAsFullScreen) {
      if (UniversalPlatform.isWeb) {
        screenManager.setWebFullScreen(false, this);
      } else {
        if (desktopOrWeb) {
          screenManager.setWindowsFullScreen(false, this);
        } else {
          screenManager.setDefaultOverlaysAndOrientations();
        }
      }
    } else {
      if (this.fullscreen.value) {
        Navigator.pop(context);
      }
    }
  }
}