buildGenericDesktopMonitorDevice function

DeviceInfo buildGenericDesktopMonitorDevice({
  1. required TargetPlatform platform,
  2. required String id,
  3. required String name,
  4. required Size screenSize,
  5. required Rect windowPosition,
  6. EdgeInsets safeAreas = EdgeInsets.zero,
  7. double pixelRatio = 2.0,
  8. EdgeInsets? rotatedSafeAreas,
  9. GenericDesktopMonitorFramePainter? framePainter,
})

Creates a generic desktop monitor device definition for the given name, target platform and screenSize. The windowPosition defines the position of a virtual window with a window frame adapted for the given platform.

Implementation

DeviceInfo buildGenericDesktopMonitorDevice({
  required TargetPlatform platform,
  required String id,
  required String name,
  required Size screenSize,
  required Rect windowPosition,
  EdgeInsets safeAreas = EdgeInsets.zero,
  double pixelRatio = 2.0,
  EdgeInsets? rotatedSafeAreas,
  GenericDesktopMonitorFramePainter? framePainter,
}) {
  final effectivePainter = framePainter ??
      GenericDesktopMonitorFramePainter(
        platform: platform,
        windowPosition: windowPosition,
      );
  return DeviceInfo(
    identifier: DeviceIdentifier(
      platform,
      DeviceType.desktop,
      id,
    ),
    name: name,
    pixelRatio: pixelRatio,
    frameSize: effectivePainter.calculateFrameSize(screenSize),
    screenSize: effectivePainter.effectiveWindowSize,
    safeAreas: safeAreas,
    rotatedSafeAreas: rotatedSafeAreas,
    framePainter: effectivePainter,
    screenPath: effectivePainter.createScreenPath(screenSize),
  );
}