PageView.builder({
Key? key,
this.scrollDirection = Axis.horizontal,
this.reverse = false,
PageController? 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,
}) : assert(allowImplicitScrolling != null),
assert(clipBehavior != null),
controller = controller ?? _defaultPageController,
childrenDelegate = SliverChildBuilderDelegate(itemBuilder, childCount: itemCount),
super(key: key);

  • scrollDirection: 设置滚动轴(垂直或水平)。
  • reverse:它定义了滚动方向,默认情况下,它被设置为false。
  • controller:用于控制页面。
  • physics: 它设置页面停止拖动后的动画。
  • onPageChanged: 当发生页面更改时调用此函数。
  • children:显示小部件列表。
  • allowImplicitScrolling: 这个属性接受一个布尔值作为对象。它控制是否将隐式滚动分配到小部件的页面。
  • childDelegate: SliverChildDelegate class is the object given to this property. It provides children widgets to PageView widget.
  • clipBehaviour: 该属性以Clip enum作为对象。它控制PageView小部件内的内容是否被剪切。
  • dragStartBehaviour:它控制拖动行为开始注册的方式。
  • pageSnapping: 它采用一个布尔值来确定页面捕捉是否为PageView小部件。
  • restoralionID: 接受一个字符串作为对象。它是用来保存滚动位置,然后恢复它。
  • scrollDirection: 这个属性将Axis enum作为对象来决定PageView的滚动轴,可以是垂直的,也可以是水平的。
    如果你有兴趣 你可以关注一下公众号 biglead 来获取最新的学习资料。