From e7dd8707744941017c9baeae5a63859dd5986f0d Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Mon, 25 Apr 2016 09:31:11 -0700 Subject: [PATCH] Improve docs for MediaQueryData.size This would have answered a question we go on flutter-dev. Fixes #3517 --- packages/flutter/lib/src/widgets/media_query.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/flutter/lib/src/widgets/media_query.dart b/packages/flutter/lib/src/widgets/media_query.dart index e4acefdbad..0e774c659c 100644 --- a/packages/flutter/lib/src/widgets/media_query.dart +++ b/packages/flutter/lib/src/widgets/media_query.dart @@ -18,14 +18,24 @@ enum Orientation { /// The result of a media query. class MediaQueryData { + /// Creates data for a media query with explicit values. + /// + /// Consider using [MediaQueryData.fromWindow] to create data based on a + /// [ui.Window]. const MediaQueryData({ this.size, this.devicePixelRatio, this.padding }); + /// Creates data for a media query based on the given window. MediaQueryData.fromWindow(ui.Window window) : size = window.size, devicePixelRatio = window.devicePixelRatio, padding = new EdgeInsets.fromWindowPadding(window.padding); - /// The size of the media (e.g, the size of the screen). + /// The size of the media in logical pixel (e.g, the size of the screen). + /// + /// Logical pixels are roughly the same visual size across devices. Physical + /// pixels are the size of the actual hardware pixels on the device. The + /// number of physical pixels per logical pixel is described by the + /// [devicePixelRatio]. final Size size; /// The number of device pixels for each logical pixel. This number might not