MediaQueryData constructor

const MediaQueryData(
  1. {Size size = Size.zero,
  2. double devicePixelRatio = 1.0,
  3. @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 = 1.0,
  4. TextScaler textScaler = _kUnspecifiedTextScaler,
  5. Brightness platformBrightness = Brightness.light,
  6. EdgeInsets padding = EdgeInsets.zero,
  7. EdgeInsets viewInsets = EdgeInsets.zero,
  8. EdgeInsets systemGestureInsets = EdgeInsets.zero,
  9. EdgeInsets viewPadding = EdgeInsets.zero,
  10. bool alwaysUse24HourFormat = false,
  11. bool accessibleNavigation = false,
  12. bool invertColors = false,
  13. bool highContrast = false,
  14. bool onOffSwitchLabels = false,
  15. bool disableAnimations = false,
  16. bool boldText = false,
  17. NavigationMode navigationMode = NavigationMode.traditional,
  18. DeviceGestureSettings gestureSettings = const DeviceGestureSettings(touchSlop: kTouchSlop),
  19. List<DisplayFeature> displayFeatures = const <ui.DisplayFeature>[]}
)

Creates data for a media query with explicit values.

In a typical application, calling this constructor directly is rarely needed. Consider using MediaQueryData.fromView to create data based on a dart:ui.FlutterView, or MediaQueryData.copyWith to create a new copy of MediaQueryData with updated properties from a base MediaQueryData.

Implementation

const MediaQueryData({
  this.size = Size.zero,
  this.devicePixelRatio = 1.0,
  @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 = 1.0,
  TextScaler textScaler = _kUnspecifiedTextScaler,
  this.platformBrightness = Brightness.light,
  this.padding = EdgeInsets.zero,
  this.viewInsets = EdgeInsets.zero,
  this.systemGestureInsets = EdgeInsets.zero,
  this.viewPadding = EdgeInsets.zero,
  this.alwaysUse24HourFormat = false,
  this.accessibleNavigation = false,
  this.invertColors = false,
  this.highContrast = false,
  this.onOffSwitchLabels = false,
  this.disableAnimations = false,
  this.boldText = false,
  this.navigationMode = NavigationMode.traditional,
  this.gestureSettings = const DeviceGestureSettings(touchSlop: kTouchSlop),
  this.displayFeatures = const <ui.DisplayFeature>[],
}) : _textScaleFactor = textScaleFactor,
     _textScaler = textScaler,
     assert(
       identical(textScaler, _kUnspecifiedTextScaler) || textScaleFactor == 1.0,
       'textScaleFactor is deprecated and cannot be specified when textScaler is specified.',
     );