I have a flutter app that show images with a CarouselSlider and InteractiveViewer so the user can pinch to zoom in and out. the problem is that it's very difficult to do this, normally the pinch movement make the CarouselSlider to slide between photos. One solution is to disable slide with neverscrollablescrollphysics() but I dont wanto to do that.
here is part of the code:
CarouselSlider(
items: widget.photos.map((i) {
return Container(
margin: EdgeInsets.all(10),
child: InteractiveViewer(
scaleEnabled: true,
minScale: 0.1,
maxScale: 10.0,
child: Image.network(i),
),
);
}).toList(),
options: CarouselOptions(
enableInfiniteScroll: false,
height: MediaQuery.of(context).size.height,
disableCenter: true,
viewportFraction: 1.0,
initialPage: widget.position,
onPageChanged: (index, reason) {
setState(() {
widget.position = index;
});
},
),
),