Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhotoViewGallery with non PhotoView widget child #126

Closed
rostopira opened this issue Apr 19, 2019 · 6 comments
Closed

PhotoViewGallery with non PhotoView widget child #126

rostopira opened this issue Apr 19, 2019 · 6 comments
Labels
enhancement New feature or request Gallery

Comments

@rostopira
Copy link

Is your feature request related to a problem? Please describe.
I'm building some kind of app internal gallery, and it has videos
I've tried to just include PhotoView widget in PageController, but with this approach PhotoView doesn't work at all

Describe the solution you'd like
I want PhotoViewGallery.builder to be able to accept non PhotoView widget

Best api, IMHO, would be like following:

    PhotoViewGallery.builder(
      pageController: PageController(initialPage: initialIndex),
      itemCount: assets.length,
      builder: (_, i) =>
        PhotoViewGalleryPageOptions(
          imageProvider: assets[i].isVideo ? null : assets[i].image,
          notImage: assets[i].isVideo ? assets[i].videoWidget : null,
        ),
    ),
@rostopira
Copy link
Author

I've found PhotoView.customChild but I want video widget appear as is, taking whole available space and no scaling

@renancaraujo
Copy link
Member

Perhaps a new constructor such as PhotoViewGalleryPageOptions.customChild would help you.

@renancaraujo renancaraujo added the enhancement New feature or request label Apr 19, 2019
@rostopira
Copy link
Author

rostopira commented Apr 23, 2019

Yeah, I will try to implement it
UPD: well, no luck, feel like an idiot now :D

@renancaraujo
Copy link
Member

@rostopira added custom child support on #131

      PhotoViewGalleryPageOptions.customChild(
            child: Container(
              width: 300,
              height: 300,
              child: SvgPicture.asset(
                item.resource,
                height: 200.0,
              ),
            ),
            childSize: const Size(300, 300),
            initialScale: PhotoViewComputedScale.contained,
            minScale: PhotoViewComputedScale.contained * (0.5 + index / 10),
            maxScale: PhotoViewComputedScale.covered * 1.1,
            heroTag: item.id,
      )

@rostopira
Copy link
Author

Thank you for this change and awesome plugin!

@renancaraujo
Copy link
Member

renancaraujo commented Apr 23, 2019

I will release it as 0.3.1
Update: done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Gallery
Projects
None yet
Development

No branches or pull requests

2 participants