marquee
marquee copied to clipboard
How to use widget instead of string for text variable?
The problem now is that the direction setting is used for the style, not the direction of the text itself, and to solve this problem, it would be better to receive a widget as a child instead of a string.
I solved this by adding textDirection: widget.textDirection
Widget marquee = ListView.builder(
controller: _controller,
scrollDirection: widget.scrollAxis,
reverse: widget.textDirection == TextDirection.rtl,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (_, i) {
final text = i.isEven
? Text(
widget.text,
style: widget.style,
textScaleFactor: widget.textScaleFactor,
textDirection: widget.textDirection,
)
: _buildBlankSpace();
return alignment == null
? text
: Align(alignment: alignment, child: text);
},
);