copyWith method
Device
copyWith({
- Size? size,
- double? devicePixelRatio,
- String? name,
- double? textScale,
- Brightness? brightness,
- EdgeInsets? safeArea,
- DisplaySize? displaySize,
- DevicePlatform? platform,
- double? screenCornerRadius,
- BorderRadius? screenCorners,
- CameraCutout? camera,
- StatusBarEdge? statusBarEdge,
- DeviceType? type,
copyWith convenience function for Device modification.
Passing screenCornerRadius alone also drops any screenCorners, so
the new radius is the one drawn.
Implementation
Device copyWith({
Size? size,
double? devicePixelRatio,
String? name,
double? textScale,
Brightness? brightness,
EdgeInsets? safeArea,
DisplaySize? displaySize,
DevicePlatform? platform,
double? screenCornerRadius,
BorderRadius? screenCorners,
CameraCutout? camera,
StatusBarEdge? statusBarEdge,
DeviceType? type,
}) {
return Device(
size: size ?? this.size,
devicePixelRatio: devicePixelRatio ?? this.devicePixelRatio,
name: name ?? this.name,
textScale: textScale ?? this.textScale,
brightness: brightness ?? this.brightness,
safeArea: safeArea ?? this.safeArea,
displaySize: displaySize ?? this.displaySize,
platform: platform ?? this.platform,
screenCornerRadius: screenCornerRadius ?? this.screenCornerRadius,
// A new uniform radius replaces per-corner radii it would otherwise
// be hidden behind, since screenCorners takes precedence.
screenCorners:
screenCorners ??
(screenCornerRadius == null ? this.screenCorners : null),
camera: camera ?? this.camera,
statusBarEdge: statusBarEdge ?? this.statusBarEdge,
type: type ?? this.type,
);
}