-
Notifications
You must be signed in to change notification settings - Fork 548
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
Add some padding between photos in gallery #42
Comments
|
I wonder why people are not interested in this basic use case 🧐 So here's my solution (probably not perfect): return Container(
child: PhotoViewGallery.builder(
itemCount: photos.length,
scrollPhysics: const BouncingScrollPhysics(),
customSize: MediaQuery.of(context).size, // 1. Set custom child size to fit to screen size
pageController: PageController(viewportFraction: 1.1), // 2. Set fraction of page viewport more than 100%
backgroundDecoration: BoxDecoration(
color: Color(0xFFFFFFFF),
),
builder: (_, index) {
return PhotoViewGalleryPageOptions.customChild(
child: Container(
color: Color(0xFFFFFFFF),
child: Image(
image: NetworkImage(photos[index].url1024),
filterQuality: FilterQuality.medium,
),
),
initialScale: PhotoViewComputedScale.contained,
minScale: PhotoViewComputedScale.contained,
);
},
),
); |
Can you review that? |
@allanwolski thanks for the effort but that won't be merged. The idea of adding padding to pages is not that simple. Wrapping internal widgets with a padding prevents the image to reach the borders of the viewport, not simply add spacing between pages, as intended. For more info: flutter/flutter#38739 |
For anyone who come to this issue for now on: Since the gallery is based on the frameworks page view, we shall not divert too much from it. We have a workaround above and some on this issue: flutter/flutter#38739 Issue to track this on the framework: flutter/flutter#78200 Consider upvoting that issue to be prioritized by the flutter team. |
Thanks for the feedback @renancaraujo The native_pdf_view package uses photo_view internally and I need to add a padding to the page. The solution proposed in #416 solves this problem. |
The gallery page options have too many options already, a large API is hard to maintain. Simply wrapping with padding and adding yet another parameter makes sense since we have the custom child support. The better solution for you seems to |
Using a custom child, the zoom is applied to the background of the page as well. Default Solution proposed in #416 Custom Child |
I have the same issue, I also need to add a padding between the pages. |
Well, we have plenty of workarounds: One here: Comments above state why this won't be worked on the photo view gallery for the reasons stated above. To avoid comments like "me too" I will be locking this issue. If you are facing this issue, you can give a thumbs up in this issue to have the flutter team prioritizing this. Any further comments or ideas on this matter feel free to open a new issue or call in the discord chat. |
Thanks for your wonderful plugin!
Can you guys, add a padding parameter to PhotoViewGallery or some where else?
I need to add some padding between photos in gallery.
The text was updated successfully, but these errors were encountered: