I am seeking to create a constant scroll of a dynamic number of images across my screen (similar to a news ticker) in Flutter. I want this to be automatic and a constant speed, that also loops.
The simplest solution I have found is to use the Carousel Package which ticks almost all the boxes, except one. I am unable to get a constant scroll speed
A possible solution was to adjust autoPlayInterval to zero, but unfortunately, this paramater appears to need a value of around 50 or greater to run - therefore creating an even scroll.
Any idea on how to tweak it this with this package? Or another suitable solution?
Simplified code:
@override
Widget build(BuildContext context) {
return Container(
child: CarouselSlider(
items: DynamicImages.list
.map(
(e) => Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset('assets/images/$e.png'),
),
)
.toList(),
options: CarouselOptions(
autoPlay: true,
autoPlayCurve: Curves.linear,
autoPlayInterval: Duration(milliseconds: 0), /// carousel will not run if set to zero
autoPlayAnimationDuration: Duration(milliseconds: 1000)
),
),
);
}
}
