autoPlay method
void
autoPlay()
Implementation
void autoPlay() {
_timer = Timer.periodic(Duration(milliseconds: widget.playDuration),
(Timer timer) {
if (widget.cycle) {
if (_index == widget.itemCount) {
_pageController.jumpToPage(0);
}
nextPage();
} else if (_index == widget.itemCount - 1) {
setIndex(0);
} else {
nextPage();
}
});
}