flutter_carousel_slider icon indicating copy to clipboard operation
flutter_carousel_slider copied to clipboard

Callback when user try to scroll from first/last page

Open brizaldi opened this issue 5 years ago • 2 comments

is there a way to get a callback so that when the user reached the first/last page and then tried to scroll to previous page (if current page is first) or scroll to next page (if current page is last)

brizaldi avatar Jun 10 '20 05:06 brizaldi

Hi, I think you can achieve this feature by using the onPageChanged callback.

serenader2014 avatar Jun 14 '20 14:06 serenader2014

I found a solution for skipping slider by scrolling on last page 👍

My Steps:

  1. Add another (empty) slide at the end of the slide list.
  2. Add condition onPageChanged body for last slide
    onPageChanged: (index, _) {

       if (index < slideList.length - 1)
         setState(() {
           _current = index;
         });
       else 
         Navigator.pushNamedAndRemoveUntil(context,.....);

ghost avatar Feb 15 '21 10:02 ghost