AnimatedText constructor
const
AnimatedText(
- String text, {
- Key? key,
- List<
TextEffect> effects = const [], - 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 AnimatedText widget that animates the given text.
text — the string to animate (required, positional).
effects — list of TextEffects composed onto the text.
controller — optional external TextEffectController.
style — text style (falls back to DefaultTextStyle).
textAlign — horizontal text alignment.
autoplay — whether playback starts on mount.
repeat — whether the animation loops indefinitely.
reverse — whether looping plays forward then backward.
textDirection — layout direction (affects alignment).
strutStyle — optional strut for consistent line height.
textHeightBehavior — optional height behavior override.
textWidthBasis — how text width is computed.
keepAlive — preserves animation in scroll-off (lazy list).
Implementation
const AnimatedText(
this.text, {
super.key,
this.effects = const [],
this.controller,
this.style,
this.textAlign = TextAlign.start,
this.autoplay = true,
this.repeat = false,
this.reverse = false,
this.textDirection = TextDirection.ltr,
this.strutStyle,
this.textHeightBehavior,
this.textWidthBasis = TextWidthBasis.parent,
this.keepAlive = true,
});