Reputation: 27
I want to create an Instagram like carousel effect with container widgets inside Flutter. I tried the "swiper_flutter" plugin but could´nt achieve the effect I wanted. You can see the sketch I've made here.
I want it to switch the content by detecting a swipe gesture. I also thought of giving the "cards" an index so it can show the count of the pages on the dots below. But I just can't figure out how to swap the container by detecting a swipe gesture.
Upvotes: 0
Views: 939
Reputation: 386
You can use PageView and the onPageChanged to re-render after scrolling
PageView(
controller: pageController,
scrollDirection: Axis.horizontal,
children: {Your items},
onPageChanged: (int index) => onPressCallback(
{Your code here}
)
Upvotes: 2