didChangeTextScaleFactor method

  1. @protected
  2. @override
  3. @mustCallSuper
void didChangeTextScaleFactor()
inherited

Called when the platform's text scale factor changes.

Implementation

@protected
@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; });
  ///   }

  /// No 'setState()' functions are allowed to fully function at this point.
  _rebuildAllowed = false;
  for (final listener in _beforeList) {
    listener.didChangeTextScaleFactor();
  }
  for (final con in _controllerList) {
    con.didChangeTextScaleFactor();
  }
  for (final listener in _afterList) {
    listener.didChangeTextScaleFactor();
  }
  _rebuildAllowed = true;
  if (_rebuildRequested || _inTester) {
    _rebuildRequested = false;

    /// Perform a 'rebuild' if requested.
    refresh();
  }
}