didChangeMetrics method
Called when the application's dimensions change. For example, when a phone is rotated.
Implementation
@protected
@override
@mustCallSuper
void didChangeMetrics() {
/// In general, this is not overridden often as the layout system takes care of
/// automatically recomputing the application geometry when the application
/// size changes
///
/// This method exposes notifications from [Window.onMetricsChanged].
/// See sample code below. No need to call super if you override.
/// @override
/// void didChangeMetrics() {
/// setState(() { _lastSize = ui.window.physicalSize; });
/// }
// A triggered system event
_hadSystemEvent = true;
/// No 'setState()' functions are allowed to fully function at this point.
_setStateAllowed = false;
for (final con in _controllerList) {
con.didChangeMetrics();
}
_setStateAllowed = true;
if (_setStateRequested) {
_setStateRequested = false;
// Only the latest State is rebuilt
if (isEndState) {
/// Perform a 'rebuild' if requested.
setState(() {});
}
}
}