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 = new EdgeInsets.fromWindowPadding(window.padding, window.devicePixelRatio),
    viewInsets = new EdgeInsets.fromWindowPadding(window.viewInsets, window.devicePixelRatio),
    alwaysUse24HourFormat = window.alwaysUse24HourFormat;