onMetricsChanged property
A callback that is invoked whenever the devicePixelRatio, physicalSize, padding, viewInsets, or systemGestureInsets values change, for example when the device is rotated or when the application is resized (e.g. when showing applications side-by-side on Android).
The engine invokes this callback in the same zone in which the callback was set.
The framework registers with this callback and updates the layout appropriately.
See also:
WidgetsBindingObserver
, for a mechanism at the widgets layer to register for notifications when this is called.MediaQuery.of
, a simpler mechanism for the same.
Implementation
VoidCallback get onMetricsChanged => _onMetricsChanged;
Implementation
set onMetricsChanged(VoidCallback callback) {
_onMetricsChanged = callback;
_onMetricsChangedZone = Zone.current;
}