getStandardWindowButtonPosition static method

Future<Rect> getStandardWindowButtonPosition({
  1. required NSWindowButtonType buttonType,
})

Gets the position of the standard window button of type buttonType.

Note: The y position is measured as the distance from the bottom of the window’s title bar.

Implementation

static Future<Rect> getStandardWindowButtonPosition(
    {required NSWindowButtonType buttonType}) async {
  await _completer.future;
  final map = await _windowManipulatorMethodChannel
      .invokeMethod('getStandardWindowButtonPosition', {
    'buttonType': buttonType.name,
  });

  return Offset(map['x'], map['y']) & Size(map['width'], map['height']);
}