marquee icon indicating copy to clipboard operation
marquee copied to clipboard

How to use widget instead of string for text variable?

Open BehroozBvk opened this issue 1 year ago • 1 comments

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.

BehroozBvk avatar Mar 10 '23 09:03 BehroozBvk

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);
      },
    );

BehroozBvk avatar Mar 10 '23 12:03 BehroozBvk