From 904653147ed9b4143f5ff3c542d0e0c35504a9d0 Mon Sep 17 00:00:00 2001 From: Chhay Toch <42688967+pirate-x@users.noreply.github.com> Date: Sat, 5 Feb 2022 23:36:45 +0700 Subject: [PATCH] fix: add padEnds property to PhotoViewGallery --- lib/photo_view_gallery.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/photo_view_gallery.dart b/lib/photo_view_gallery.dart index 229eb534..e7aa3e63 100644 --- a/lib/photo_view_gallery.dart +++ b/lib/photo_view_gallery.dart @@ -116,6 +116,7 @@ class PhotoViewGallery extends StatefulWidget { this.scrollDirection = Axis.horizontal, this.customSize, this.allowImplicitScrolling = false, + this.padEnds = true, }) : itemCount = null, builder = null, super(key: key); @@ -139,6 +140,7 @@ class PhotoViewGallery extends StatefulWidget { this.scrollDirection = Axis.horizontal, this.customSize, this.allowImplicitScrolling = false, + this.padEnds = true, }) : pageOptions = null, assert(itemCount != null), assert(builder != null), @@ -189,6 +191,9 @@ class PhotoViewGallery extends StatefulWidget { /// When user attempts to move it to the next element, focus will traverse to the next page in the page view. final bool allowImplicitScrolling; + // Whether to add padding to both ends of the list. Mirror to [PageView.padEnds] + final bool padEnds; + bool get _isBuilder => builder != null; @override @@ -232,6 +237,7 @@ class _PhotoViewGalleryState extends State { scrollDirection: widget.scrollDirection, physics: widget.scrollPhysics, allowImplicitScrolling: widget.allowImplicitScrolling, + padEnds: widget.padEnds, ), ); }