ImageSpan class final

行内图片。排版时占一个 size 的框, 由 LabelPainter 在框内补画。

与 WidgetSpan 不同, 尺寸由自身给出, 不需要先 TextPainter.setPlaceholderDimensions。

Inheritance

Constructors

ImageSpan(Image image, Size size, {PlaceholderAlignment alignment = ui.PlaceholderAlignment.middle, TextBaseline? baseline})
const

Properties

alignment → PlaceholderAlignment
How the placeholder aligns vertically with the text.
finalinherited
baseline → TextBaseline?
The TextBaseline to align against when using ui.PlaceholderAlignment.baseline, ui.PlaceholderAlignment.aboveBaseline, and ui.PlaceholderAlignment.belowBaseline.
finalinherited
hashCode → int
The hash code for this object.
no setteroverride
image → Image
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → Size
final
style → TextStyle?
The TextStyle to apply to this span.
finalinherited

Methods

build(ParagraphBuilder builder, {TextScaler textScaler = TextScaler.noScaling, List<PlaceholderDimensions>? dimensions}) → void
Apply the properties of this object to the given ParagraphBuilder, from which a Paragraph can be obtained.
override
codeUnitAt(int index) → int?
Returns the UTF-16 code unit at the given index in the flattened string.
inherited
codeUnitAtVisitor(int index, Accumulator offset) → int?
Performs the check at each InlineSpan for if the index falls within the range of the span and returns the corresponding code unit. Returns null otherwise.
override
compareTo(InlineSpan other) → RenderComparison
图片换了实例或尺寸、对齐变化都要重排: 占位框尺寸与位置由它们决定。
override
computeSemanticsInformation(List<InlineSpanSemanticsInformation> collector) → void
Walks the InlineSpan tree and accumulates a list of InlineSpanSemanticsInformation objects.
inherited
computeToPlainText(StringBuffer buffer, {bool includeSemanticsLabels = true, bool includePlaceholders = true}) → void
PlaceholderSpans are flattened to a 0xFFFC object replacement character in the plain text representation when includePlaceholders is true.
inherited
debugAssertIsValid() → bool
PlaceholderSpan 的默认实现是 assert(false, ...), 而 TextPainter.text setter 会递归校验, 不覆写则一赋值就断言失败; ImageSpan 自带尺寸、不依赖 WidgetSpan 的布局协议, 恒为有效。
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
getSemanticsInformation() → List<InlineSpanSemanticsInformation>
Flattens the InlineSpan tree to a list of InlineSpanSemanticsInformation objects.
inherited
getSpanForPosition(TextPosition position) → InlineSpan?
Returns the InlineSpan that contains the given position in the text.
inherited
getSpanForPositionVisitor(TextPosition position, Accumulator offset) → InlineSpan?
Performs the check at each InlineSpan for if the position falls within the range of the span and returns the span if it does.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toPlainText({bool includeSemanticsLabels = true, bool includePlaceholders = true}) → String
Flattens the InlineSpan tree into a single string.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited
visitChildren(InlineSpanVisitor visitor) → bool
Walks this InlineSpan and any descendants in pre-order and calls visitor for each span that has content.
override
visitDirectChildren(InlineSpanVisitor visitor) → bool
Calls visitor for each immediate child of this InlineSpan.
override

Operators

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