serenader2014 / flutter_carousel_slider

A flutter carousel widget, support infinite scroll, and custom child widget.
https://pub.dev/packages/carousel_slider
MIT License
1.55k stars 517 forks source link

is there a way to build a carousel that works like a subtitle? #397

Open mahdiqdi opened 1 year ago

mahdiqdi commented 1 year ago

hi guys. i want to build something like subtitle and everything is ok but there is a problem about width i take a list from api and maybe text is too long or too short but page width does not change by text length and cause some empty spaces or overflow

List test = ['test a', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna', ''Lorem ipsum dolor sit amet, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna'];

CarouselSlider( items: test.map((i) { return Builder( builder: (BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Text(i), Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), child: Container( height: 20, width: 2, color: primary1, ), ) ], ); }, ); }).toList(), options: CarouselOptions( height: 200, aspectRatio: 2, animateToClosest: true, initialPage: 0, pauseAutoPlayOnManualNavigate: false, enableInfiniteScroll: true, reverse: false, autoPlay: true, autoPlayInterval: const Duration(milliseconds: 100), autoPlayAnimationDuration: const Duration(seconds: 20), autoPlayCurve: Curves.linear, enlargeCenterPage: false, padEnds: false, pageSnapping: true, enlargeFactor: 0, scrollDirection: Axis.horizontal, ), ),

this is my code but preview is not consistent and it has empty space or overflow plz help me with my problem