Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- StatefulBuilder(builder: (context, setState) {
- return CarouselSlider.builder(
- carouselController: carouselController,
- itemCount: model.advertList.length,
- itemBuilder: (context, index, i) {
- AdvertModel ad = model.advertList[index];
- // model.determineCarouselLength(, type)
- return ad.advertMediaType!.mediaType == "video"
- ? AjeoVideoPlayer(
- videoUrl: ad.advertMedia!,
- viewModel: model,
- // type: e.advertMediaType!.mediaType!
- )
- : CarouselImage(
- size: size,
- e: ad,
- viewModel: model,
- );
- },
- options: CarouselOptions(
- // onScrolled: ,
- height: 160.h,
- aspectRatio: 16 / 9,
- viewportFraction: 1.0,
- initialPage: 0,
- // enableInfiniteScroll: true,
- reverse: false,
- autoPlay: isPlaying,
- autoPlayInterval: model.carouselDuration,
- autoPlayAnimationDuration: const Duration(seconds: 4),
- autoPlayCurve: Curves.easeInOutQuart,
- enlargeCenterPage: true,
- onPageChanged: (index, reason) {
- model.setCurrentIndex(index);
- // setState(() {
- // model.carouselDuration = Duration(seconds: 40);
- // });
- log(model.carouselDuration.toString());
- },
- // onPageChanged: callbackFunction,
- scrollDirection: Axis.horizontal,
- ));
- }),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement