GesturePageView.builder constructor

GesturePageView.builder({
  1. Key? key,
  2. Axis scrollDirection = Axis.horizontal,
  3. bool reverse = false,
  4. ExtendedPageController? controller,
  5. ScrollPhysics? physics,
  6. bool pageSnapping = true,
  7. ValueChanged<int>? onPageChanged,
  8. required IndexedWidgetBuilder itemBuilder,
  9. int? itemCount,
  10. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  11. bool allowImplicitScrolling = false,
  12. String? restorationId,
  13. Clip clipBehavior = Clip.hardEdge,
  14. ScrollBehavior? scrollBehavior,
  15. bool padEnds = true,
  16. int preloadPagesCount = 0,
})

Creates a scrollable list that works page by page using widgets that are created on demand.

This constructor is appropriate for page views with a large (or infinite) number of children because the builder is called only for those children that are actually visible.

Providing a non-null itemCount lets the GesturePageView compute the maximum scroll extent.

itemBuilder will be called only with indices greater than or equal to zero and less than itemCount.

PageView.builder by default does not support child reordering. If you are planning to change child order at a later time, consider using GesturePageView or PageView.custom.

If allowImplicitScrolling is true, the PageView will participate in accessibility scrolling more like a ListView, where implicit scroll actions will move to the next page rather than into the contents of the PageView.

Implementation

GesturePageView.builder({
  Key? key,
  this.scrollDirection = Axis.horizontal,
  this.reverse = false,
  ExtendedPageController? controller,
  this.physics,
  this.pageSnapping = true,
  this.onPageChanged,
  required IndexedWidgetBuilder itemBuilder,
  int? itemCount,
  this.dragStartBehavior = DragStartBehavior.start,
  this.allowImplicitScrolling = false,
  this.restorationId,
  this.clipBehavior = Clip.hardEdge,
  this.scrollBehavior,
  this.padEnds = true,
  this.preloadPagesCount = 0,
})  : assert(allowImplicitScrolling != null),
      assert(clipBehavior != null),
      controller = controller ?? _defaultPageController,
      childrenDelegate =
          SliverChildBuilderDelegate(itemBuilder, childCount: itemCount),
      super(key: key);