MarcelGarus / marquee

A Flutter widget that scrolls text infinitely. Provides many customizations including custom scroll directions and velocities, pausing after every round and specifying custom durations and curves for accelerating and decelerating.
MIT License
274 stars 113 forks source link

How to use widget instead of string for text variable? #88

Open BehroozBvk opened 1 year ago

BehroozBvk commented 1 year ago

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 commented 1 year ago

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