flutter_carousel_slider icon indicating copy to clipboard operation
flutter_carousel_slider copied to clipboard

Interactive viewer not working with carousel slider

Open Maverick-Wolf opened this issue 3 years ago • 5 comments

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

Maverick-Wolf avatar Oct 16 '22 09:10 Maverick-Wolf

The same here!

tomasweigenast avatar Nov 08 '22 13:11 tomasweigenast

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.

HankG avatar Jan 30 '23 05:01 HankG

same issue

swkim-lbstech avatar Apr 26 '23 07:04 swkim-lbstech

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.

EArminjon avatar Sep 13 '23 14:09 EArminjon

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:

  1. listen to onInteractionEnd in InteractiveViewer. Get if child is zoomed in using TransformationController
  2. set PageView scroll physics to NeverScrollableScrollPhysics when child is zoomed in
  3. 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.

nWacky avatar Apr 16 '24 10:04 nWacky