copyWith method
- Size? size,
- double? devicePixelRatio,
- @Deprecated('Use textScaler instead. ' 'Use of textScaleFactor was deprecated in preparation for the upcoming nonlinear text scaling support. ' 'This feature was deprecated after v3.12.0-2.0.pre.') double? textScaleFactor,
- TextScaler? textScaler,
- Brightness? platformBrightness,
- EdgeInsets? padding,
- EdgeInsets? viewPadding,
- EdgeInsets? viewInsets,
- EdgeInsets? systemGestureInsets,
- bool? alwaysUse24HourFormat,
- bool? highContrast,
- bool? onOffSwitchLabels,
- bool? disableAnimations,
- bool? invertColors,
- bool? boldText,
- DeviceGestureSettings? gestureSettings,
- List<
DisplayFeature> ? displayFeatures, - bool? supportsShowingSystemContextMenu,
Creates a copy of this media query data but with the given fields replaced with the new values.
The textScaler
parameter and textScaleFactor
parameter must not be
both specified.
Implementation
MediaQueryData copyWith({
Size? size,
double? devicePixelRatio,
@Deprecated(
'Use textScaler instead. '
'Use of textScaleFactor was deprecated in preparation for the upcoming nonlinear text scaling support. '
'This feature was deprecated after v3.12.0-2.0.pre.',
)
double? textScaleFactor,
TextScaler? textScaler,
Brightness? platformBrightness,
EdgeInsets? padding,
EdgeInsets? viewPadding,
EdgeInsets? viewInsets,
EdgeInsets? systemGestureInsets,
bool? alwaysUse24HourFormat,
bool? highContrast,
bool? onOffSwitchLabels,
bool? disableAnimations,
bool? invertColors,
bool? accessibleNavigation,
bool? boldText,
NavigationMode? navigationMode,
DeviceGestureSettings? gestureSettings,
List<ui.DisplayFeature>? displayFeatures,
bool? supportsShowingSystemContextMenu,
}) {
assert(textScaleFactor == null || textScaler == null);
if (textScaleFactor != null) {
textScaler ??= TextScaler.linear(textScaleFactor);
}
return MediaQueryData(
size: size ?? this.size,
devicePixelRatio: devicePixelRatio ?? this.devicePixelRatio,
textScaler: textScaler ?? this.textScaler,
platformBrightness: platformBrightness ?? this.platformBrightness,
padding: padding ?? this.padding,
viewPadding: viewPadding ?? this.viewPadding,
viewInsets: viewInsets ?? this.viewInsets,
systemGestureInsets: systemGestureInsets ?? this.systemGestureInsets,
alwaysUse24HourFormat: alwaysUse24HourFormat ?? this.alwaysUse24HourFormat,
invertColors: invertColors ?? this.invertColors,
highContrast: highContrast ?? this.highContrast,
onOffSwitchLabels: onOffSwitchLabels ?? this.onOffSwitchLabels,
disableAnimations: disableAnimations ?? this.disableAnimations,
accessibleNavigation: accessibleNavigation ?? this.accessibleNavigation,
boldText: boldText ?? this.boldText,
navigationMode: navigationMode ?? this.navigationMode,
gestureSettings: gestureSettings ?? this.gestureSettings,
displayFeatures: displayFeatures ?? this.displayFeatures,
supportsShowingSystemContextMenu: supportsShowingSystemContextMenu ?? this.supportsShowingSystemContextMenu,
);
}