DeviceFrame.custom constructor
DeviceFrame.custom(
- double width,
- double height, {
- String? id,
- String? label,
- double devicePixelRatio = 1.0,
- BezelConfig? bezel,
- EdgeInsets? safeArea,
Build a custom frame. label and id are derived from dimensions when
the caller does not provide them, so typical embedded targets can pass
just the two sizes.
Implementation
factory DeviceFrame.custom(
double width,
double height, {
String? id,
String? label,
double devicePixelRatio = 1.0,
BezelConfig? bezel,
EdgeInsets? safeArea,
}) {
final resolvedLabel =
label ?? '${width.toStringAsFixed(0)}×${height.toStringAsFixed(0)}';
final resolvedId =
id ?? 'custom-${width.toStringAsFixed(0)}x${height.toStringAsFixed(0)}';
return DeviceFrame(
id: resolvedId,
label: resolvedLabel,
logicalSize: Size(width, height),
devicePixelRatio: devicePixelRatio,
bezel: bezel,
safeArea: safeArea,
);
}