AnimatedRichText class
Displays text with mixed static and animated segments.
Each TextSegment can be either static (no animation) or animated with its own list of TextEffects. All segments are concatenated into a single string, but effects only apply to animated segments.
AnimatedRichText(
segments: [
TextSegment.static('Hello '),
TextSegment.animated('World', effects: [WaveEffect()]),
TextSegment.static('!'),
],
style: TextStyle(fontSize: 32),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AnimatedRichText
Constructors
-
AnimatedRichText({Key? key, required List<
TextSegment> segments, TextEffectController? controller, TextStyle? style, TextAlign textAlign = TextAlign.start, bool autoplay = true, bool repeat = false, bool reverse = false, TextDirection textDirection = TextDirection.ltr, StrutStyle? strutStyle, TextHeightBehavior? textHeightBehavior, TextWidthBasis textWidthBasis = TextWidthBasis.parent, bool keepAlive = true}) -
Creates an AnimatedRichText from mixed static/animated segments.
const
Properties
- autoplay → bool
-
Whether playback begins automatically on mount.
final
- controller → TextEffectController?
-
Optional external controller for shared playback orchestration.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- keepAlive → bool
-
When true (default), animation state survives scroll-off in a lazy list.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- repeat → bool
-
Whether the animation loops indefinitely.
final
- reverse → bool
-
Whether repeated animations play forwards then backwards.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
segments
→ List<
TextSegment> -
The text segments composing the full text.
final
- strutStyle → StrutStyle?
-
Optional strut style for consistent line height.
final
- style → TextStyle?
-
Text style applied to every character. Defaults to DefaultTextStyle.
final
- textAlign → TextAlign
-
Alignment of the text within its bounds.
final
- textDirection → TextDirection
-
Text direction for layout.
final
- textHeightBehavior → TextHeightBehavior?
-
Optional text height behavior override.
final
- textWidthBasis → TextWidthBasis
-
How text width is computed relative to the parent.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< AnimatedRichText> -
Creates the mutable state for this widget at a given location in the tree.
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
-
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
-
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 short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited