InlineSpan class

An immutable span of inline content which forms part of a paragraph.

This example shows a tree of InlineSpans that make a query asking for a name with a TextField embedded inline.
Text.rich(
  TextSpan(
    text: 'My name is ',
    style: TextStyle(color: Colors.black),
    children: <InlineSpan>[
      WidgetSpan(
        alignment: PlaceholderAlignment.baseline,
        baseline: TextBaseline.alphabetic,
        child: ConstrainedBox(
          constraints: BoxConstraints(maxWidth: 100),
          child: TextField(),
        )
      ),
      TextSpan(
        text: '.',
      ),
    ],
  ),
)

See also:

Inheritance
Implementers
Annotations
  • @immutable

Constructors

InlineSpan({TextStyle style })
Creates an InlineSpan with the given values.
const

Properties

children List<InlineSpan>
Returns the InlineSpan children list associated with this span if this is an instance of TextSpan, otherwise returns null.
@Deprecated('InlineSpan does not innately have children. Use TextSpan.children instead.'), read-only
hashCode int
The hash code for this object. [...]
read-only, override
recognizer GestureRecognizer
Returns the GestureRecognizer associated with this span if this is an instance of TextSpan, otherwise returns null.
@Deprecated('InlineSpan does not innately have a recognizer. Use TextSpan.recognizer instead.'), read-only
style TextStyle
The TextStyle to apply to this span. [...]
final
text String
Returns the text associated with this span if this is an instance of TextSpan, otherwise returns null.
@Deprecated('InlineSpan does not innately have text. Use TextSpan.text instead.'), read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

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. [...]
codeUnitAt(int index) int
Returns the UTF-16 code unit at the given index in the flattened string. [...]
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
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. [...]
computeSemanticsInformation(List<InlineSpanSemanticsInformation> collector) → void
Walks the InlineSpan tree and accumulates a list of InlineSpanSemanticsInformation objects. [...]
@protected
computeToPlainText(StringBuffer buffer, { bool includeSemanticsLabels: true, bool includePlaceholders: true }) → void
Walks the InlineSpan tree and writes the plain text representation to buffer. [...]
@protected
debugAssertIsValid() bool
In checked mode, throws an exception if the object is not in a valid configuration. Otherwise, returns true. [...]
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
override
describeSemantics(Accumulator offset, List<int> semanticsOffsets, List semanticsElements) → void
Populates the semanticsOffsets and semanticsElements with the appropriate data to be able to construct a SemanticsNode. [...]
@Deprecated('Implement computeSemanticsInformation instead.')
getSemanticsInformation() List<InlineSpanSemanticsInformation>
Flattens the InlineSpan tree to a list of InlineSpanSemanticsInformation objects. [...]
getSpanForPosition(TextPosition position) InlineSpan
Returns the InlineSpan that contains the given position in the text.
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
toPlainText({bool includeSemanticsLabels: true, bool includePlaceholders: true }) String
Flattens the InlineSpan tree into a single string. [...]
visitChildren(InlineSpanVisitor visitor) bool
Walks this InlineSpan and any descendants in pre-order and calls visitor for each span that has content. [...]
visitTextSpan(bool visitor(TextSpan span)) bool
Walks this TextSpan and any descendants in pre-order and calls visitor for each span that has content. [...]
@Deprecated('Use visitChildren instead')
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
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
toString({DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns 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

Operators

operator ==(dynamic other) bool
The equality operator. [...]
override