Add troubleshooting doc for MediaQueryData.size (#104828)
This commit is contained in:
parent
64b08f3c56
commit
c68fd6a31a
@ -159,6 +159,23 @@ class MediaQueryData {
|
|||||||
/// pixels are the size of the actual hardware pixels on the device. The
|
/// pixels are the size of the actual hardware pixels on the device. The
|
||||||
/// number of physical pixels per logical pixel is described by the
|
/// number of physical pixels per logical pixel is described by the
|
||||||
/// [devicePixelRatio].
|
/// [devicePixelRatio].
|
||||||
|
///
|
||||||
|
/// ## Troubleshooting
|
||||||
|
///
|
||||||
|
/// It is considered bad practice to cache and later use the size returned
|
||||||
|
/// by `MediaQuery.of(context).size`. It will make the application non responsive
|
||||||
|
/// and might lead to unexpected behaviors.
|
||||||
|
/// For instance, during startup, especially in release mode, the first returned
|
||||||
|
/// size might be (0,0). The size will be updated when the native platform
|
||||||
|
/// reports the actual resolution.
|
||||||
|
///
|
||||||
|
/// See the article on [Creating responsive and adaptive
|
||||||
|
/// apps](https://docs.flutter.dev/development/ui/layout/adaptive-responsive)
|
||||||
|
/// for an introduction.
|
||||||
|
///
|
||||||
|
/// See also:
|
||||||
|
///
|
||||||
|
/// * [FlutterView.physicalSize], which returns the size in physical pixels.
|
||||||
final Size size;
|
final Size size;
|
||||||
|
|
||||||
/// The number of device pixels for each logical pixel. This number might not
|
/// The number of device pixels for each logical pixel. This number might not
|
||||||
|
Loading…
x
Reference in New Issue
Block a user