addToolbar static method

Future<void> addToolbar({
  1. Toolbar toolbar = const DefaultToolbar(),
})

Adds a toolbar to the window.

By default, the added toolbar is a DefaultToolbar.

A BlockingToolbar can be added like this:

WindowManipulator.addToolbar(
  toolbar: const BlockingToolbar(blockingAreaDebugColor: Colors.red)),
);

Blocking toolbars contain an area that stops double clicks from zooming the window, thus allowing for the placement of buttons that can be clicked repeatedly.

Setting the blockingAreaDebugColor to an easily visible color can be useful for debugging purposes:

image

You may wish to hide the native title to extend the blocking area:

image

Implementation

static Future<void> addToolbar(
    {Toolbar toolbar = const DefaultToolbar()}) async {
  await _completer.future;
  await _windowManipulatorMethodChannel.invokeMethod(
    'addToolbar',
    {
      'toolbarName': toolbar.getName(),
      'toolbarArguments': toolbar.getArguments(),
    },
  );
}