MediaQueryData.fromWindow constructor

MediaQueryData.fromWindow(Window window)

Creates data for a media query based on the given window.

If you use this, you should ensure that you also register for notifications so that you can update your MediaQueryData when the window's metrics change. For example, see WidgetsBindingObserver.didChangeMetrics or Window.onMetricsChanged.

Implementation

MediaQueryData.fromWindow(ui.Window window)
  : size = window.physicalSize / window.devicePixelRatio,
    devicePixelRatio = window.devicePixelRatio,
    textScaleFactor = window.textScaleFactor,
    padding = EdgeInsets.fromWindowPadding(window.padding, window.devicePixelRatio),
    viewInsets = EdgeInsets.fromWindowPadding(window.viewInsets, window.devicePixelRatio),
    accessibleNavigation = window.accessibilityFeatures.accessibleNavigation,
    invertColors = window.accessibilityFeatures.invertColors,
    disableAnimations = window.accessibilityFeatures.disableAnimations,
    boldText = window.accessibilityFeatures.boldText,
    alwaysUse24HourFormat = window.alwaysUse24HourFormat;