textScaler property
The font scaling strategy to use for laying out textual contents.
If this MediaQueryData is created by the MediaQueryData.fromView constructor, this property reflects the platform's preferred text scaling strategy, and may change as the user changes the scaling factor in the operating system's accessibility settings.
See also:
- MediaQuery.textScalerOf, a method to find and depend on the textScaler defined for a BuildContext.
- TextPainter, a class that lays out and paints text.
Implementation
TextScaler get textScaler {
// The constructor was called with an explicitly specified textScaler value,
// we assume the caller is migrated and ignore _textScaleFactor.
if (!identical(_kUnspecifiedTextScaler, _textScaler)) {
return _textScaler;
}
return _textScaleFactor == 1.0
// textScaleFactor and textScaler from the constructor are consistent.
? TextScaler.noScaling
// The constructor was called with an explicitly specified textScaleFactor,
// we assume the caller is unmigrated and ignore _textScaler.
: TextScaler.linear(_textScaleFactor);
}