flutter_carousel_slider
flutter_carousel_slider copied to clipboard
CarouselSlider & PhotoView, touch conflicts
Hey!
I'm currently using PhotoView to zoom on my Video & Photo carousel and as I can see, I got touch conflict when I want to zoom on my image. In fact, when I'm trying to zoom and swipe to right (to see the right side of my image), my carousel swipe too and my image changes.
Do you know any way to fix this?
return Scaffold(
resizeToAvoidBottomInset: false,
body: CarouselSlider.builder(
itemCount: widget.medias.length,
options: CarouselOptions(
aspectRatio: MediaQuery.of(context).size.aspectRatio,
disableCenter: true,
initialPage: widget.index,
enableInfiniteScroll: false,
viewportFraction: 1.0,
enlargeCenterPage: false,
),
itemBuilder: (context, index) {
var media = widget.medias[index];
if (media.mediaType == MediaType.image) {
return Hero(
tag: widget.medias[widget.index].hashCode,
child: PhotoView(
minScale: PhotoViewComputedScale.contained,
imageProvider: CachedNetworkImageProvider(media.url),
backgroundDecoration: BoxDecoration(color: CustomColor.mainColor),
),
);
} else {
return Center(
child:
kReleaseMode ? YoutubePlayer(controller: _youtubePlayerControllers[index]) : Container(alignment: Alignment.center, child: Text(media.url)),
);
}
},
),
);
ref to PhotoView ticket: https://github.com/fireslime/photo_view/issues/351
I wanted to replace my dependency to a very similar package but not maintained one (https://github.com/best-flutter/flutter_swiper) but I encountered with this same issue. Although on my case I actually have the PhotoView around the carousel, so that the zoom is not clipped by the near items. PhotoView works correctly with flutter_swiper.
padEnds: false
Any solutions to it?