addFullScreenPresentationOption static method
Adds a NSAppPresentationOption to the window as a full-screen presentation option.
Note: The following restrictions on the combination of presentation options that can be set simultaneously apply:
autoHideDock
andhideDock
are mutually exclusive: You may specify one or the other, but not both.autoHideMenuBar
andhideMenuBar
are mutually exclusive: You may specify one or the other, but not both.- If you specify
hideMenuBar
, it must be accompanied byhideDock
. - If you specify
autoHideMenuBar
, it must be accompanied by eitherhideDock
orautoHideDock
. - If you specify any of
disableProcessSwitching
,disableForceQuit
,disableSessionTermination
, ordisableMenuBarTransparency
, it must be accompanied by eitherhideDock
orautoHideDock
. autoHideToolbar
may be used only when bothfullScreen
andautoHideMenuBar
are also set.
When NSApplication
receives a parameter value that does not conform to
these requirements, it raises an invalidArgumentException
.
For this reason, it is recommended to use NSAppPresentationOptions instead, as NSAppPresentationOptions will throw assertion errors when used incorrectly:
// Returns normally.
NSAppPresentationOptions.from({
NSAppPresentationOption.autoHideToolbar,
NSAppPresentationOption.fullScreen,
NSAppPresentationOption.autoHideMenuBar,
NSAppPresentationOption.hideDock,
}).applyAsFullScreenPresentationOptions();
// Throws assertion error.
NSAppPresentationOptions.from({
NSAppPresentationOption.autoHideDock,
NSAppPresentationOption.hideDock
}).applyAsFullScreenPresentationOptions();
Implementation
static Future<void> addFullScreenPresentationOption(
NSAppPresentationOption option) async {
await _completer.future;
final hasSucceeded = await _windowManipulatorMethodChannel.invokeMethod(
'addFullScreenPresentationOption',
{'presentationOption': option.name}) as bool;
assert(
hasSucceeded,
'addFullScreenPresentationOption failed. Please make sure that the '
'`enableWindowDelegate` parameter is set to true in your '
'WindowManipulator.initialize call.');
}