LabelPainter class final
带背景与边框的标签绘制器, 跨帧持有排版结果。
对标 RenderParagraph: 持有者每帧照常传 style、key 与 build, 内部 diff; 内容与样式都没变时不格式化、不排版、不分配。
- Implemented types
Constructors
- LabelPainter({int capacity = 1})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void -
释放原生资源(如 TextPainter 持有的 ui.Paragraph)。之后不可再用。
override
-
measure(
Object key, {Object build()?, required LabelStyle style, Rect? bounds, double minWidth = 0}) → Size - 标签外框尺寸(含 padding 与 AnchoredBorder 的外延), 用于绘制前决定摆放。
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paint(
Canvas canvas, Object key, {Object build()?, required LabelStyle style, required Offset anchor, Alignment align = Alignment.topLeft, Rect? bounds, double minWidth = 0}) → Rect - 画标签, 返回容器矩形(含 padding, 不含 AnchoredBorder 的外延)。
-
paintAround(
Canvas canvas, Object key, {Object build()?, required LabelStyle styleOf(AxisDirection side), required Rect target, required AxisDirection side, double spacing = 0, bool flip = true, Rect? bounds}) → Rect -
围绕
target画标签, 返回容器矩形: 按side一侧的样式测量, 经 placeAround 决定实际所在侧, 再以该侧样式绘制。 -
reset(
) → void -
丢弃缓存内容, 对象本身保留可继续使用。
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited