Typewriter class final

Text that types itself out in a running app, like a typewriter or a terminal: charsPerSecond characters a second after delayMs, with a blinking block caret after the last one while it types. It types when the text first shows and again from the start when playKey changes; when the text grows by appending (a streamed reply) only the new characters type, and when it changes otherwise it types afresh. skip (bindable, e.g. to a tap that sets a variable) shows the rest at once; off enabled it shows all of it. The layout never changes as it types: the whole text is laid out and only what's typed is painted. The design canvas shows it all.

Annotations
  • @immutable

Constructors

Typewriter({bool enabled = true, double charsPerSecond = 40, int delayMs = 0, bool caret = true, Color? caretColor, double caretWidth = 0, double caretHeight = 0, double caretGap = 1, TextStyle caretAlignStyle = TextStyle.empty, int blinkMs = 500, bool skip = false, String playKey = '', int? holdAtMs, bool grow = false})
const

Properties

blinkMs → int
How long the caret stays on, and off (ms).
final
caret → bool
Whether a block caret blinks after the last character while it types.
final
caretAlignStyle → TextStyle
With caretHeight: the style whose middle the caret centers on, as a middle-aligned widget span outside the text's own span takes its paragraph's style (e.g. the app's default text style). Empty: the text's own.
final
caretColor → Color?
The caret's color, painted as given; null uses the text's, a little faded.
final
caretGap → double
The space between the last character and the caret.
final
caretHeight → double
The caret's height, centered on the text's middle (as a widget span aligned to the middle of the line); 0 is about three quarters of the line, from just below its top.
final
caretWidth → double
The caret's width; 0 is about half the font size.
final
charsPerSecond → double
How fast it types (bindable as typewriter.charsPerSecond).
final
delayMs → int
How long (ms) it waits before the first character (bindable as typewriter.delayMs, e.g. to follow the line before it).
final
enabled → bool
Off, the whole text shows (bindable as typewriter.enabled).
final
grow → bool
The node is only as tall as the lines typed so far, growing line by line (a note card that fills as it's written). Off, it keeps the whole text's size from the start, so nothing around it moves.
final
hashCode → int
The hash code for this object.
no setterinherited
holdAtMs → int?
Stops the typing clock this many ms after it starts (its delay included): the text holds part-typed, caret blinking, as a still of the moment (bindable as typewriter.holdAtMs). Lines that type one after another (each delayed by the ones before) all stop at the same moment. Null types to the end.
final
playKey → String
A cue: types again from the start each time it changes (bindable as typewriter.playKey).
final
props → List<Object?>
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
skip → bool
Shows the rest of the text at once (bindable as typewriter.skip).
final
types → bool
Whether a running app types (rather than shows the whole text).
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Json
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

fromJson(Object? json) → Typewriter?