Skip to content

Commit

Permalink
Added pageSnapping option (#542)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LucazzP authored Apr 16, 2024
1 parent d2865d3 commit 163f383
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/photo_view_gallery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class PhotoViewGallery extends StatefulWidget {
this.scrollDirection = Axis.horizontal,
this.customSize,
this.allowImplicitScrolling = false,
this.pageSnapping = true,
}) : itemCount = null,
builder = null,
super(key: key);
Expand All @@ -141,6 +142,7 @@ class PhotoViewGallery extends StatefulWidget {
this.scrollDirection = Axis.horizontal,
this.customSize,
this.allowImplicitScrolling = false,
this.pageSnapping = true,
}) : pageOptions = null,
assert(itemCount != null),
assert(builder != null),
Expand Down Expand Up @@ -194,6 +196,8 @@ 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;

final bool pageSnapping;

bool get _isBuilder => builder != null;

@override
Expand Down Expand Up @@ -237,6 +241,7 @@ class _PhotoViewGalleryState extends State<PhotoViewGallery> {
scrollDirection: widget.scrollDirection,
physics: widget.scrollPhysics,
allowImplicitScrolling: widget.allowImplicitScrolling,
pageSnapping: widget.pageSnapping,
),
);
}
Expand Down

0 comments on commit 163f383

Please sign in to comment.