TextPainterMeasurer class final

使用 TextPainter 测量;默认不缩放、从左向右整形。

每种样式最多保留一个 painter;例如 measurer.measure('奖品', style)。

Implemented types

Constructors

TextPainterMeasurer({TextScaler textScaler = TextScaler.noScaling, TextDirection textDirection = TextDirection.ltr})
创建测量器;textScaler 控制缩放,textDirection 只控制文字整形。

Properties

debugPainters → List<TextPainter>
仅供测试检查复用与释放;返回当前缓存资源的只读快照。
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

baseline(TextStyle style) → double
返回行顶到字母基线的距离。
override
dispose() → void
释放并清空全部缓存资源;可重复调用。
override
measure(String text, TextStyle style) → double
返回单行宽度,包含尾随空格,字号向零截断。
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited