Mohamed Shaheen
Mohamed Shaheen

Reputation: 663

Flutter swiper disable swipe when last index

I am using this plugin flutter_swiper:

Swiper(
        index: currentIndex,
        itemCount: 12,
        itemBuilder: (BuildContext context,int index){
          return PhotoView(
            imageProvider: AssetImage("images/c"+(index+1).toString()+".jpg"),
          );
        },
      ),

I need the swiper to not swipe from last index to first index and not from first to last only swipe between indexes. what I have is a list of images to swipe between Is it possible to do this using this plugin or I should use another one ? if so please provide another solution

Upvotes: 0

Views: 1392

Answers (1)

Pablo Barrera
Pablo Barrera

Reputation: 10963

It seems to be that Swiper has a property for that, called loop:

/// Set to false to disable continuous loop mode.
final bool loop;

So you could try:

Swiper(
   loop: false,
   ...

Upvotes: 1

Related Questions