Skip to content

Commit 163f383

Browse files
authored
Added pageSnapping option (#542)
Adds the pageSnapping option to give the dev the option to view continually the image from the gallery, without snapping every time. The main reason for me doing this addition is to add this option also on the [pdfx](https://pub.dev/packages/pdfx) package, it is useful for the web apps with vertical viewing.
1 parent d2865d3 commit 163f383

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/photo_view_gallery.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class PhotoViewGallery extends StatefulWidget {
117117
this.scrollDirection = Axis.horizontal,
118118
this.customSize,
119119
this.allowImplicitScrolling = false,
120+
this.pageSnapping = true,
120121
}) : itemCount = null,
121122
builder = null,
122123
super(key: key);
@@ -141,6 +142,7 @@ class PhotoViewGallery extends StatefulWidget {
141142
this.scrollDirection = Axis.horizontal,
142143
this.customSize,
143144
this.allowImplicitScrolling = false,
145+
this.pageSnapping = true,
144146
}) : pageOptions = null,
145147
assert(itemCount != null),
146148
assert(builder != null),
@@ -194,6 +196,8 @@ class PhotoViewGallery extends StatefulWidget {
194196
/// When user attempts to move it to the next element, focus will traverse to the next page in the page view.
195197
final bool allowImplicitScrolling;
196198

199+
final bool pageSnapping;
200+
197201
bool get _isBuilder => builder != null;
198202

199203
@override
@@ -237,6 +241,7 @@ class _PhotoViewGalleryState extends State<PhotoViewGallery> {
237241
scrollDirection: widget.scrollDirection,
238242
physics: widget.scrollPhysics,
239243
allowImplicitScrolling: widget.allowImplicitScrolling,
244+
pageSnapping: widget.pageSnapping,
240245
),
241246
);
242247
}

0 commit comments

Comments
 (0)