Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

a flutter carousel slider widget, support infinite scroll and custom child widget, with autoplay feature.

installation

add carousel_slider: ^0.0.7 in your pubspec.yaml dependencies.

how to use

simply create a carousel slider carouselslider widget, and pass the required params:

new carouselslider(
  items: [1,2,3,4,5].map((i) {
    return new builder(
      builder: (buildcontext context) {
        return new container(
          width: mediaquery.of(context).size.width,
          margin: new edgeinsets.symmetric(horizontal: 5.0),
          decoration: new boxdecoration(
            color: colors.amber
          ),
          child: new text('text $i', style: new textstyle(fontsize: 16.0),)
        );
      },
    );
  }).tolist(),
  height: 400.0,
  autoplay: true
)

for a more detail example please take a look at the example folder.

carousel slider w/infinite scroll
carousel slider w/infinite scroll

params

new carouselslider(
  items: items,
  viewportfraction: 0.8,
  initialpage: 0,
  aspectratio: 16/9,
  height: 400,
  reverse: false,
  autoplay: false,
  interval: const duration(seconds: 4),
  autoplaycurve: curves.fastoutslowin,
  autoplayduration: const duration(milliseconds: 800),
  updatecallback: somefunction
)

you can pass the above params to the class. if you pass the height params, the aspectratio param will be ignore.

instance methods

you can use the instance methods to programmatically take control of the pageview’s position.

.nextpage({duration duration, curve curve})

animate to the next page

.previouspage({duration duration, curve curve})

animate to the previous page

.jumptopage(int page)

jump to the given page.

.animatetopage(int page, {duration duration, curve curve})

animate to the given page.


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.