addScreen method

Future<ScreenInfo> addScreen(
  1. int left,
  2. int top,
  3. int width,
  4. int height, {
  5. WorkAreaInsets? workAreaInsets,
  6. num? devicePixelRatio,
  7. int? rotation,
  8. int? colorDepth,
  9. String? label,
  10. bool? isInternal,
})

Add a new screen to the device. Only supported in headless mode. left Offset of the left edge of the screen in pixels. top Offset of the top edge of the screen in pixels. width The width of the screen in pixels. height The height of the screen in pixels. workAreaInsets Specifies the screen's work area. Default is entire screen. devicePixelRatio Specifies the screen's device pixel ratio. Default is 1. rotation Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0. colorDepth Specifies the screen's color depth in bits. Default is 24. label Specifies the descriptive label for the screen. Default is none. isInternal Indicates whether the screen is internal to the device or external, attached to the device. Default is false.

Implementation

Future<ScreenInfo> addScreen(
  int left,
  int top,
  int width,
  int height, {
  WorkAreaInsets? workAreaInsets,
  num? devicePixelRatio,
  int? rotation,
  int? colorDepth,
  String? label,
  bool? isInternal,
}) async {
  var result = await _client.send('Emulation.addScreen', {
    'left': left,
    'top': top,
    'width': width,
    'height': height,
    if (workAreaInsets != null) 'workAreaInsets': workAreaInsets,
    if (devicePixelRatio != null) 'devicePixelRatio': devicePixelRatio,
    if (rotation != null) 'rotation': rotation,
    if (colorDepth != null) 'colorDepth': colorDepth,
    if (label != null) 'label': label,
    if (isInternal != null) 'isInternal': isInternal,
  });
  return ScreenInfo.fromJson(result['screenInfo'] as Map<String, dynamic>);
}