flutter_carousel_slider icon indicating copy to clipboard operation
flutter_carousel_slider copied to clipboard

CarouselSlider & PhotoView, touch conflicts

Open Naografix opened this issue 4 years ago • 3 comments

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

Naografix avatar Oct 22 '20 16:10 Naografix

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.

davidmartos96 avatar Oct 26 '20 14:10 davidmartos96

padEnds: false

tnitsiri avatar Dec 09 '23 18:12 tnitsiri

Any solutions to it?

hadi7khan avatar Dec 31 '23 14:12 hadi7khan