serenader2014 / flutter_carousel_slider

A flutter carousel widget, support infinite scroll, and custom child widget.
https://pub.dev/packages/carousel_slider
MIT License
1.6k stars 581 forks source link

handle onTap event also #163

Open giorgio79 opened 4 years ago

giorgio79 commented 4 years ago

Hello,

I noticed the carousel does not scroll when I tap on the next or previous items. It only reacts to dragging.

serenader2014 commented 4 years ago

Sorry, can you provide more info?

giorgio79 commented 4 years ago

I think it would be Gesture Detection. When you tap on an image there is no scroll to it at the moment. You have to hold and scroll...

serenader2014 commented 4 years ago

Hi @giorgio79 , I think you can wrap your carousel slider children in a gesture detector, and add this functionality in the gesture detector callback.

karthikgs-in commented 3 years ago

Hello, this is a continuation of the previous request as I also need this in my application. I have put an InkWell in my carousel items, but how can I access the value of the current page within that scope? I use onPageChanged (value, reason) to update my widget state. Thanks in advance!

alexlovar commented 3 years ago

Hello.,did you solve this? ie: if you want to see full screen one of the image of the carrousel when you tap in this? how do you manage the ontap event to open the selected(tapped) image?

karthikgs-in commented 3 years ago

Yes. In your case, wrap each item in a gesture detector / inkwell, and onTap, navigate to a new screen/dialog passing the index of the current item.

oyakyazilim commented 2 years ago

That is not working, when u wrap Item with GestureDetector you should tap twice for onTap functionality... First tap always used to stop the animation of Carousel.

fabianotavallini commented 11 months ago

That is not working, when u wrap Item with GestureDetector you should tap twice for onTap functionality... First tap always used to stop the animation of Carousel.

I experience the same behavior, is there some way to call the onTap method inside each item when the CrouselSlider is animating during autoplay animation?