Flutter之滑动列表PageView

class PageView extends StatefulWidget {
  /// Creates a scrollable list that works page by page from an explicit [List]
  /// of widgets.
  ///
  /// This constructor is appropriate for page views with a small number of
  /// children because constructing the [List] requires doing work for every
  /// child that could possibly be displayed in the page view, instead of just
  /// those children that are actually visible.
    从显式[list]创建一个逐页工作的可滚动列表
    的小部件。
    此构造函数适用于数量较少的页面视图
    因为构建[列表]需要为每个人做工作
    可以在页面视图中显示的子元素,而不只是
    这些孩子实际上是可见的。
  PageView({
    Key key, 
    this.scrollDirection = Axis.horizontal, //滚动的方向 支持水平和垂直两个方向
    this.reverse = false, //是否反转滚动
    PageController controller, //pageView控制类
    this.physics,  //手势滚动逻辑,支持:不滚动、总是滚动、与滚动到边缘时是否有bounce
    this.pageSnapping = true, //设置为false以禁用页面捕捉,对自定义滚动行为很有用
    this.onPageChanged, //页面切换时调用
    List<Widget> children = const <Widget>[], //pageView要显示的页面
    this.dragStartBehavior = DragStartBehavior.start,
  }) : controller = controller ?? _defaultPageController,
       childrenDelegate = SliverChildListDelegate(children),
       super(key: key);
}
发布了66 篇原创文章 · 获赞 36 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/u013600907/article/details/101455765
今日推荐