flutter_carousel_slider
flutter_carousel_slider copied to clipboard
Interactive viewer not working with carousel slider
Wrapping the Image.asset with interactive viewer inside the carousel slider doesn't seem to be working, as am unable to zoom in the images
The same here!
I was able to get this working by setting the disableGesture setting on CarouselSlider to true. It can still be a bit finicky where I have to tap once on the image and then I can zoom in. Panning still doesn't work like it usually does except when there is only one image though.
same issue
I was able to make photo_view working using the disableGesture property at true
interestingly disableGesture still allow slide to be scrollable. I think disableGesture'name is not well relevant.
Under the hood this library is using PageView.builder
PageView is scrollable.
InteractiveViewer inside PageView doesn't work with scaling very well because both are listening to scroll events.
It seems to be a flutter issue: https://github.com/flutter/flutter/issues/68594
On stackoverflow people are suggesting to:
- listen to
onInteractionEndinInteractiveViewer. Get if child is zoomed in usingTransformationController - set
PageViewscroll physics toNeverScrollableScrollPhysicswhen child is zoomed in - allow scrolling when child is not zoomed in
Perhaps, it's better to disable interaction/scrolling in carousel and only listen to onInteraction* events in InteractiveViewer.
Then when child is not zoomed in, panning can be detected from onInteraction* manually. Then carousel could be switched to next slide using PageController
When child is zoomed in only let InteractiveViewer handle panning and do nothing with PageController.