Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 0 additions & 179 deletions example/pubspec.lock

This file was deleted.

17 changes: 17 additions & 0 deletions lib/preload_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class PreloadPageController extends ScrollController {
this.initialPage = 0,
this.keepPage = true,
this.viewportFraction = 1.0,
this.padEnds = true,
}) : assert(viewportFraction > 0.0);

/// The page to show when first creating the [PreloadPageView].
Expand Down Expand Up @@ -52,6 +53,21 @@ class PreloadPageController extends ScrollController {
/// direction.
final double viewportFraction;

/// Whether to add padding to both ends of the list.
///
/// If this is set to true and [viewportFraction] < 1.0, padding will be added
/// such that the first and last child slivers will be in the center of
/// the viewport when scrolled all the way to the start or end, respectively.
/// You may want to set this to false if this [SliverFillViewport] is not the only
/// widget along this main axis, such as in a [CustomScrollView] with multiple
/// children.
///
/// This option cannot be null. If [viewportFraction] >= 1.0, this option has no
/// effect. Defaults to true.
final bool padEnds;



/// The current page displayed in the controlled [PreloadPageView].
///
/// There are circumstances that this [PreloadPageController] can't know the current
Expand Down Expand Up @@ -626,6 +642,7 @@ class _PreloadPageViewState extends State<PreloadPageView> {
slivers: <Widget>[
SliverFillViewport(
viewportFraction: widget.controller.viewportFraction,
padEnds: widget.controller.padEnds,
delegate: widget.childrenDelegate),
],
);
Expand Down