PlaceholderSpan class Null safety
An immutable placeholder that is embedded inline within text.
PlaceholderSpan represents a placeholder that acts as a stand-in for other content. A PlaceholderSpan by itself does not contain useful information to change a TextSpan. Instead, this class must be extended to define contents.
WidgetSpan from the widgets library extends PlaceholderSpan and may be used instead to specify a widget as the contents of the placeholder.
See also:
- WidgetSpan, a leaf node that represents an embedded inline widget.
- TextSpan, a node that represents text in a TextSpan tree.
- Text, a widget for showing uniformly-styled text.
- RichText, a widget for finer control of text rendering.
- TextPainter, a class for painting TextSpan objects on a Canvas.
- Inheritance
-
- Object
- DiagnosticableTree
- InlineSpan
- PlaceholderSpan
- Implementers
Constructors
- PlaceholderSpan({PlaceholderAlignment alignment = ui.PlaceholderAlignment.bottom, TextBaseline? baseline, TextStyle? style})
-
Creates a PlaceholderSpan with the given values.
const
Properties
- alignment → PlaceholderAlignment
-
How the placeholder aligns vertically with the text.
final
- baseline → TextBaseline?
-
The TextBaseline to align against when using ui.PlaceholderAlignment.baseline,
ui.PlaceholderAlignment.aboveBaseline, and ui.PlaceholderAlignment.belowBaseline.
final
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- style → TextStyle?
-
The TextStyle to apply to this span.
finalinherited
Methods
-
build(
ParagraphBuilder builder, {double textScaleFactor = 1.0, List< PlaceholderDimensions> ? dimensions}) → void -
Apply the properties of this object to the given ParagraphBuilder, from
which a Paragraph can be obtained.
inherited
-
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.protected">@protectedinherited -
compareTo(
InlineSpan other) → RenderComparison -
Describe the difference between this span and another, in terms of
how much damage it will make to the rendering. The comparison is deep.
inherited
-
computeSemanticsInformation(
List< InlineSpanSemanticsInformation> collector) → void -
Walks the InlineSpan tree and accumulates a list of
InlineSpanSemanticsInformation objects.
override
-
computeToPlainText(
StringBuffer buffer, {bool includeSemanticsLabels = true, bool includePlaceholders = true}) → void -
PlaceholderSpans are flattened to a
0xFFFC
object replacement character in the plain text representation whenincludePlaceholders
is true.override -
debugAssertIsValid(
) → bool -
In debug mode, throws an exception if the object is not in a
valid configuration. Otherwise, returns true.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children.protected">@protectedinherited -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
describeSemantics(
Accumulator offset, List< int> semanticsOffsets, List semanticsElements) → void -
Populates the
semanticsOffsets
andsemanticsElements
with the appropriate data to be able to construct a SemanticsNode. -
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.protected">@protectedinherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent 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}) → 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.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- placeholderCodeUnit → const int
-
The unicode character to represent a placeholder.
0xFFFC