ScrollTextsWidget class
A highly efficient, modular widget for smoothly scrolling a list of text strings.
Supports dual render modes:
- ScrollTextRenderMode.cached: Lays out text once and clips on GPU.
- ScrollTextRenderMode.streaming: Sliding window layout that only measures and renders what is physically visible in the widget window.
- ScrollTextRenderMode.auto: Automatically selects the optimal mode.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ScrollTextsWidget
Constructors
-
ScrollTextsWidget({Key? key, required List<
String> texts, TextStyle textStyle = const TextStyle(fontSize: 18.0, color: Colors.black), double scrollSpeed = 50.0, Duration pauseDuration = const Duration(seconds: 2), Duration initialDelay = Duration.zero, TextDirection textDirection = TextDirection.ltr, ScrollTextRenderMode renderMode = ScrollTextRenderMode.auto, bool repeat = true, ScrollTextsController? controller, double initialScrollOffset = 0.0, int initialTextIndex = 0, void onScrollChanged(double offset, int textIndex)?, void onTextCompleted(int textIndex)?}) -
Creates a ScrollTextsWidget that cycles through
textswith continuous horizontal marquee scrolling.const
Properties
- controller → ScrollTextsController?
-
Optional controller to monitor position, pause/resume, or jump.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialDelay → Duration
-
Optional duration to wait before beginning the initial scroll of the first text.
Defaults to Duration.zero.
final
- initialScrollOffset → double
-
Initial pixel scroll offset for the first text.
final
- initialTextIndex → int
-
Initial text index from texts to display.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onScrollChanged → void Function(double offset, int textIndex)?
-
Optional callback invoked as the scroll offset changes.
final
- onTextCompleted → void Function(int textIndex)?
-
Optional callback invoked when a text has completed its full scroll.
final
- pauseDuration → Duration
-
The duration to pause after one text has fully scrolled off-screen
before the next text begins its scroll.
final
- renderMode → ScrollTextRenderMode
-
Rendering strategy to use. Defaults to ScrollTextRenderMode.auto.
final
- repeat → bool
-
Whether to continuously cycle through the text playlist. Defaults to true.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollSpeed → double
-
The speed of the scroll in pixels per second (px/s).
final
- textDirection → TextDirection
-
The direction the text should be laid out and scrolled.
Defaults to TextDirection.ltr (Left-to-Right scrolling).
final
-
texts
→ List<
String> -
The list of strings to cycle and scroll through.
final
- textStyle → TextStyle
-
The style applied to the text.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ScrollTextsWidget> -
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