didChangeTextScaleFactor method
Called when the platform's text scale factor changes.
Implementation
@override
@mustCallSuper
void didChangeTextScaleFactor() {
///
/// This typically happens as the result of the user changing system
/// preferences, and it should affect all of the text sizes in the
/// application.
///
/// This method exposes notifications from [Window.onTextScaleFactorChanged].
/// See sample code below. No need to call super if you override.
/// @override
/// void didChangeTextScaleFactor() {
/// setState(() { _lastTextScaleFactor = ui.window.textScaleFactor; });
/// }
// A triggered system event
_hadSystemEvent = true;
// Don't if the State object is defunct.
if (!mounted) {
return;
}
/// No 'setState()' functions are allowed to fully function at this point.
_setStateAllowed = false;
for (final con in controllerList) {
con.didChangeTextScaleFactor();
}
_setStateAllowed = true;
if (_setStateRequested) {
_setStateRequested = false;
// Only the latest State is rebuilt
if (isLastState) {
/// Perform a 'rebuild' if requested.
setState(() {});
}
}
}