WindowManager class

The pre-nativeapi WindowManager on top of a single nativeapi.Window, for code that has not moved to the native API yet.

Every call goes to the window the platform currently considers the app's own. 0.5.x only ever addressed one window; an app with several of them should use the native API, where each nativeapi.Window is addressed directly.

Annotations
  • @Deprecated('The 0.5.x compatible API will be removed in a future release. Use the native API from package:window_manager/window_manager.dart.')

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
no setter
listeners → List<WindowListener>
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(WindowListener listener) → void
blur() → Future<void>
Removes focus from the window.
center({bool animate = false}) → Future<void>
Moves window to the center of the screen.
close() → Future<void>
Try to close the window.
destroy() → Future<void>
Force closing the window, past setPreventClose.
dock({required DockSide side, required int width}) → Future<void>
Reserves width logical pixels at the monitor's side for this window.
ensureInitialized() → Future<void>
Connects listeners registered before the native window was available.
focus() → Future<void>
Focuses on the window.
getBounds() → Future<Rect>
Returns Rect - The bounds of the window as Object.
getDevicePixelRatio() → double
getId() → Future<int>
Returns int - The ID of the window.
getOpacity() → Future<double>
Returns double - between 0.0 (fully transparent) and 1.0 (fully opaque).
getPosition() → Future<Offset>
Returns Offset - Contains the window's current position.
getSize() → Future<Size>
Returns Size - Contains the window's width and height.
getTitle() → Future<String>
Returns String - The title of the native window.
getTitleBarHeight() → Future<int>
Returns int - The title bar height of the native window.
grabKeyboard() → Future<bool>
Grabs the keyboard.
hasShadow() → Future<bool>
Returns bool - Whether the window has a shadow. On Windows, always returns true unless window is frameless.
hide() → Future<void>
Hides the window.
isAlwaysOnBottom() → Future<bool>
Returns bool - Whether the window is always below other windows.
isAlwaysOnTop() → Future<bool>
Returns bool - Whether the window is always on top of other windows.
isClosable() → Future<bool>
Returns bool - Whether the window can be manually closed by user.
isDockable() → Future<bool>
Whether the system supports reserving desktop space for a docked window.
isDocked() → Future<DockSide?>
Returns the edge reserved by this window, or null when undocked.
isFocused() → Future<bool>
Returns bool - Whether window is focused.
isFullScreen() → Future<bool>
Returns bool - Whether the window is in fullscreen mode.
isMaximizable() → Future<bool>
Returns bool - Whether the window can be manually maximized by the user.
isMaximized() → Future<bool>
Returns bool - Whether the window is maximized.
isMinimizable() → Future<bool>
Returns bool - Whether the window can be manually minimized by the user.
isMinimized() → Future<bool>
Returns bool - Whether the window is minimized.
isMovable() → Future<bool>
Returns bool - Whether the window can be moved by user.
isPreventClose() → Future<bool>
Check if is intercepting the native close signal.
isResizable() → Future<bool>
Returns bool - Whether the window can be manually resized by the user.
isSkipTaskbar() → Future<bool>
Returns bool - Whether skipping taskbar is enabled.
isVisible() → Future<bool>
Returns bool - Whether the window is visible to the user.
isVisibleOnAllWorkspaces() → Future<bool>
Returns bool - Whether the window is visible on all workspaces.
maximize({bool vertically = false}) → Future<void>
Maximizes the window, or only its height on Windows with vertically.
minimize() → Future<void>
Minimizes the window. On some platforms the minimized window will be shown in the Dock.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
popUpWindowMenu() → Future<void>
Opens the window menu at the cursor.
removeListener(WindowListener listener) → void
restore() → Future<void>
Restores the window from minimized state to its previous state.
setAlignment(Alignment alignment, {bool animate = false}) → Future<void>
Move the window to a position aligned with the screen.
setAlwaysOnBottom(bool isAlwaysOnBottom) → Future<void>
Sets whether the window should show always below other windows.
setAlwaysOnTop(bool isAlwaysOnTop) → Future<void>
Sets whether the window should show always on top of other windows.
setAsFrameless() → Future<void>
You can call this to remove the window frame (title bar, outline border, etc), which is basically everything except the Flutter view, also can call setTitleBarStyle(TitleBarStyle.normal) to restore it.
setAspectRatio(double aspectRatio) → Future<void>
This will make a window maintain an aspect ratio.
setBackgroundColor(Color backgroundColor) → Future<void>
Sets the background color of the window.
setBadgeLabel([String? label]) → Future<void>
Set/unset label on taskbar(dock) app icon
setBounds(Rect? bounds, {Offset? position, Size? size, bool animate = false}) → Future<void>
Resizes and moves the window to the supplied bounds.
setBrightness(Brightness brightness) → Future<void>
Sets the brightness of the window.
setClosable(bool isClosable) → Future<void>
Sets whether the window can be manually closed by user.
setFullScreen(bool isFullScreen) → Future<void>
Sets whether the window should be in fullscreen mode.
setHasShadow(bool hasShadow) → Future<void>
Sets whether the window should have a shadow. On Windows, doesn't do anything unless window is frameless.
setIcon(String iconPath) → Future<void>
Sets window/taskbar icon.
setIgnoreMouseEvents(bool ignore, {bool forward = false}) → Future<void>
Makes the window ignore all mouse events.
setMaximizable(bool isMaximizable) → Future<void>
Sets whether the window can be manually maximized by the user.
setMaximumSize(Size size) → Future<void>
Sets the maximum size of window to width and height.
setMinimizable(bool isMinimizable) → Future<void>
Sets whether the window can be manually minimized by user.
setMinimumSize(Size size) → Future<void>
Sets the minimum size of window to width and height.
setMovable(bool isMovable) → Future<void>
Sets whether the window can be moved by user.
setOpacity(double opacity) → Future<void>
Sets the opacity of the window.
setPosition(Offset position, {bool animate = false}) → Future<void>
Moves window to position, with a native animation on macOS if requested.
setPreventClose(bool isPreventClose) → Future<void>
Set if intercept the native close signal. May useful when combine with the onclose event listener.
setProgressBar(double progress) → Future<void>
Sets progress value in progress bar. Valid range is 0, 1.0.
setResizable(bool isResizable) → Future<void>
Sets whether the window can be manually resized by the user.
setSize(Size size, {bool animate = false}) → Future<void>
Resizes the window to width and height.
setSkipTaskbar(bool isSkipTaskbar) → Future<void>
Makes the window not show in the taskbar / dock.
setTitle(String title) → Future<void>
Changes the title of native window to title.
setTitleBarStyle(TitleBarStyle titleBarStyle, {bool windowButtonVisibility = true}) → Future<void>
Changes the title bar style of native window.
setVisibleOnAllWorkspaces(bool visible, {bool? visibleOnFullScreen}) → Future<void>
Sets whether the window should be visible on all workspaces.
show({bool inactive = false}) → Future<void>
Shows and gives focus to the window.
startDragging() → Future<void>
Starts a window drag based on the specified mouse-down event.
startResizing(ResizeEdge resizeEdge) → Future<void>
Starts a window resize based on the specified mouse-down & mouse-move event.
toString() → String
A string representation of this object.
inherited
undock() → Future<bool>
Removes the desktop reservation and restores the window's previous bounds.
ungrabKeyboard() → Future<bool>
Ungrabs the keyboard.
unmaximize() → Future<void>
Unmaximizes the window.
waitUntilReadyToShow([WindowOptions? options, VoidCallback? callback]) → Future<void>
Wait until ready to show.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

instance → WindowManager
The shared instance of WindowManager.
final