KineticText class

Text with motion — shaped once, animated per letter, word or line.

KineticText(
  'Fresh harvest, every morning',
  style: theme.headline,
  unit: TextUnit.word,
  effects: const [Rise(distance: 10)],
)

KineticText.rich([
  const TextRun('Pay '),
  TextRun('12,000', effects: [Highlight(color: tint)]),
], style: theme.body)

One-shot effects (Rise, Glint, Blur, Typewriter, the sweep of a Highlight or Underline) play over duration once on mount (or when replayKey changes, or from a KineticController). Loops (Shimmer, Sparkle, Float, a flowing GradientInk) run on their own clock while the widget is on screen.

Lays out like a Text: it reads the ambient DefaultTextStyle, Directionality, text scale and bold-text setting, wraps to its constraints, reports intrinsic sizes and a text baseline, and speaks its plain text to assistive technology.

Reduced motion (the platform flag, or reduceMotion) resolves every one-shot to its end state, stops every loop, and keeps every fill, marker and underline that is not motion.

Inheritance

Constructors

KineticText(String text, {Key? key, TextStyle? style, List<TextEffect> effects = const [], TextUnit unit = TextUnit.grapheme, TextAlign? textAlign, TextDirection? textDirection, int? maxLines, TextOverflow? overflow, Locale? locale, StrutStyle? strutStyle, bool pinLineHeight = false, TextHeightBehavior? textHeightBehavior, bool autoplay = true, Duration duration = const Duration(milliseconds: 900), Duration delay = Duration.zero, KineticController? controller, Animation<double>? progress, Object? replayKey, bool? reduceMotion, String? semanticsLabel, VoidCallback? onEnd})
A plain label.
const
KineticText.rich(List<TextRun> runs, {Key? key, TextStyle? style, List<TextEffect> effects = const [], TextUnit unit = TextUnit.grapheme, TextAlign? textAlign, TextDirection? textDirection, int? maxLines, TextOverflow? overflow, Locale? locale, StrutStyle? strutStyle, bool pinLineHeight = false, TextHeightBehavior? textHeightBehavior, bool autoplay = true, Duration duration = const Duration(milliseconds: 900), Duration delay = Duration.zero, KineticController? controller, Animation<double>? progress, Object? replayKey, bool? reduceMotion, String? semanticsLabel, VoidCallback? onEnd})
A label of several TextRuns, each with its own style and effects.
const

Properties

autoplay → bool
Play the one-shot effects once on mount.
final
controller → KineticController?
External play control.
final
delay → Duration
Wait before the autoplay starts. Cancelled if the widget unmounts first.
final
duration → Duration
Length of the one-shot run.
final
effects → List<TextEffect>
Effects over the whole text. Run-scoped effects come from TextRun.effects.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
locale → Locale?
Null reads the ambient Localizations locale.
final
maxLines → int?
Null reads the ambient DefaultTextStyle.maxLines.
final
onEnd → VoidCallback?
Called when the one-shot run completes.
final
overflow → TextOverflow?
How overflowing text is handled. Null reads the ambient DefaultTextStyle.overflow. TextOverflow.ellipsis ellipsizes the last line; TextOverflow.visible never clips; anything else clips to the box only when the text overflows it (an effect may still paint outside the box while it moves). TextOverflow.fade is treated as clip.
final
pinLineHeight → bool
Force the strut so the box height is the style's line height regardless of script — a Latin ↔ Arabic swap then never grows the box.
final
plainText → String
The plain text, whichever constructor was used.
no setter
progress → Animation<double>?
Drive the one-shot progress from outside instead of the internal clock — a scroll position, a parent's controller. autoplay, duration, delay and controller are ignored when set.
final
reduceMotion → bool?
Null reads the platform "disable animations" flag.
final
replayKey → Object?
A change replays the one-shot effects.
final
runs → List<TextRun>?
The runs, for KineticText.rich.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticsLabel → String?
Null speaks the plain text.
final
strutStyle → StrutStyle?
An explicit strut. Takes precedence over pinLineHeight.
final
style → TextStyle?
The base style, merged over the ambient DefaultTextStyle; a run's own style is merged over it.
final
text → String?
The plain text, for the default constructor.
final
textAlign → TextAlign?
Null reads the ambient DefaultTextStyle.textAlign, else start.
final
textDirection → TextDirection?
Null reads the ambient Directionality.
final
textHeightBehavior → TextHeightBehavior?
Null reads the ambient DefaultTextStyle.textHeightBehavior.
final
unit → TextUnit
What a stagger counts and a pose moves.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<KineticText>
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