apply method

Future<void> apply()

Applies the configuration to the macOS window.

This method:

Implementation

Future<void> apply() async {
  WidgetsFlutterBinding.ensureInitialized();
  await WindowManipulator.initialize(enableWindowDelegate: true);
  await WindowManipulator.setMaterial(
    NSVisualEffectViewMaterial.windowBackground,
  );
  if (enableFullSizeContentView) {
    await WindowManipulator.enableFullSizeContentView();
  }
  if (makeTitlebarTransparent) {
    await WindowManipulator.makeTitlebarTransparent();
  }
  if (hideTitle) {
    await WindowManipulator.hideTitle();
  }
  await WindowManipulator.addToolbar();

  await WindowManipulator.setToolbarStyle(
    toolbarStyle: toolbarStyle,
  );

  if (removeMenubarInFullScreenMode) {
    final delegate = _FlutterWindowDelegate();
    WindowManipulator.addNSWindowDelegate(delegate);
  }

  if (autoHideToolbarAndMenuBarInFullScreenMode) {
    final options = NSAppPresentationOptions.from({
      NSAppPresentationOption.fullScreen,
      NSAppPresentationOption.autoHideToolbar,
      NSAppPresentationOption.autoHideMenuBar,
      NSAppPresentationOption.autoHideDock,
    });
    options.applyAsFullScreenPresentationOptions();
  }
}