TextScaler class abstract
A class that describes how textual contents should be scaled for better readability.
The scale function computes the scaled font size given the original unscaled font size specified by app developers.
The == operator defines the equality of 2 TextScalers, which the framework uses to determine whether text widgets should rebuild when their TextScaler changes. Consider overriding the == operator if applicable to avoid unnecessary rebuilds.
- Annotations
Constructors
- TextScaler()
-
Creates a TextScaler.
const
- TextScaler.linear(double textScaleFactor)
-
Creates a proportional TextScaler that scales the incoming font size by
multiplying it with the given
textScaleFactor
.constfactory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textScaleFactor → double
-
The estimated number of font pixels for each logical pixel. This property
exists only for backward compatibility purposes, and will be removed in
a future version of Flutter.
no setter
Methods
-
clamp(
{double minScaleFactor = 0, double maxScaleFactor = double.infinity}) → TextScaler -
Returns a new TextScaler that restricts the scaled font size to within
the range
[minScaleFactor * fontSize, maxScaleFactor * fontSize]
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
scale(
double fontSize) → double -
Computes the scaled font size (in logical pixels) with the given unscaled
fontSize
(in logical pixels). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- noScaling → const TextScaler
- A TextScaler that doesn't scale the input font size.