RollingText class

A StatefulWidget that provides a rolling text effect.

This widget takes in an old text and a new text, and creates a rolling animation from the old text to the new text. The rolling effect can be customized with various parameters such as the curve of the roll, whether the tapes should be staggered, the softness of the stagger, and more.

The text style, alignment, directionality, and other text properties can also be customized.

Inheritance
Available Extensions

Constructors

RollingText({Key? key, required String oldText, required String newText, EdgeInsets padding = EdgeInsets.zero, SymbolTapeStrategy tapeStrategy = const ConsistentSymbolTapeStrategy(0), Curve? tapeCurve, TapeSlideDirection tapeSlideDirection = TapeSlideDirection.up, Clip clipBehavior = Clip.hardEdge, bool staggerTapes = true, int staggerSoftness = 1, bool reverseStaggerDirection = false, double? fixedTapeWidth, Duration? widthDuration, Curve? widthCurve, TextStyle? style, StrutStyle? strutStyle, TextAlign? textAlign, TextDirection? textDirection, Locale? locale, bool? softWrap, TextOverflow? overflow, TextScaler? textScaler, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? selectionColor})
Creates a new RollingText with the given parameters.
const

Properties

clipBehavior Clip
Determines how the text should be clipped. The rendered text is going to be a fixed-height box based on the font size.
final
fixedTapeWidth double?
Can be optionally used to set a fixed width for each tape. If null, the width of each tape will be the width of the active character in the tape. If not null, the width of each tape will be the fixed width provided. Note that this will allow the text's characters to potentially overlap each other.
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?
Used to select a font when the same Unicode character can be rendered differently, depending on the locale.
final
maxLines int?
An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to overflow.
final
newText String
The text to display interpolating to.
final
oldText String
The text to display interpolating away from.
final
overflow TextOverflow?
How visual overflow should be handled.
final
padding EdgeInsets
Internal padding to apply between the row of symbol tapes and the clipping mask.
final
reverseStaggerDirection bool
Determines whether the stagger effect should be reversed. Normally, the staggering makes the beginning letters move fast and the ending letters move slow. If this is set to true, the staggering will be reversed, so the beginning letters will move slow and the ending letters will move fast.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectionColor Color?
The color to use when painting the selection.
final
semanticsLabel String?
An alternative semantics label for this text.
final
softWrap bool?
Whether the text should break at soft line breaks.
final
staggerSoftness int
Determines how harsh the stagger effect is. The higher the number, the more the stagger effect is softened, and the interpolation between each tape will more similar to each other.
final
staggerTapes bool
Determines whether the tapes should be staggered or not. If set to true, the starting tapes will move and end their sliding faster than the ending tapes.
final
strutStyle StrutStyle?
The strut style to use. Strut style defines the strut, which sets minimum vertical layout metrics.
final
style TextStyle?
If non-null, the style to use for this text.
final
tapeCurve Curve?
Used to determine the curve each roll of symbol tape uses to slide up and down through its characters. If null, the same curve is used as the one provided to the animate function.
final
tapeSlideDirection TapeSlideDirection
Determines the direction in which each tape of characters will slide.
final
tapeStrategy SymbolTapeStrategy
Used to determine the string of characters to create and roll through for each character index between the old and new text.
final
textAlign TextAlign?
How the text should be aligned horizontally.
final
textDirection TextDirection?
The directionality of the text.
final
textHeightBehavior TextHeightBehavior?
Defines how to apply TextStyle.height over and under text.
final
textScaler TextScaler?
The font scaling strategy to use when laying out and rendering the text.
final
textWidthBasis TextWidthBasis?
Defines how to measure the width of the rendered text.
final
widthCurve Curve?
The widthCurve parameter is used to determine the curve of the width animation of each tape. If null, the same curve is used as the one provided to the animate function.
final
widthDuration Duration?
The widthDuration parameter is used to determine the duration of the width animation of each tape. If null, the same duration is used as the one provided to the animate function.
final

Methods

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