杭州专业做网站公司,西安网站建设工作室,保定徐水网站建设,网站浮动窗口代码phpPageView组件说明 组件说明PageView#xff0c;PageController的源码简单demo 组件说明 
属性说明scrollDirection滑动反向 Axis.vertical上下滑动 Axis.horizontal左右滑动reverse是否反转 true从最后一个记0controllerPageController见下文physics滚动方式pageSnapping是否有… PageView组件说明 组件说明PageViewPageController的源码简单demo 组件说明 
属性说明scrollDirection滑动反向 Axis.vertical上下滑动 Axis.horizontal左右滑动reverse是否反转 true从最后一个记0controllerPageController见下文physics滚动方式pageSnapping是否有回弹效果onPageChanged监听切换children子组件dragStartBehavior处理拖拽开始行为方式 
PageController的属性说明 
属性说明initialPage初始化第一次默认在第几个keepPage是否保存当前 Page 的状态 true下次回复对应保存的 page initialPage被忽略 false总是从 initialPage 开始viewportFraction占屏幕多少1为占满整个屏幕 
PageViewPageController的源码 
2.1、PageView源码 
PageView({Key? key,this.scrollDirection  Axis.horizontal,//滑动方向this.reverse  false,//是否反转true 从最后一个记0PageController? controller,//控制初始化this.physics,//滚动方式this.pageSnapping  true,//是否有回弹效果this.onPageChanged,//监听切换ListWidget children  const Widget[],//子组件this.dragStartBehavior  DragStartBehavior.start,//处理拖拽开始行为方式this.allowImplicitScrolling  false,this.restorationId,this.clipBehavior  Clip.hardEdge,}) : assert(allowImplicitScrolling ! null),assert(clipBehavior ! null),controller  controller ?? _defaultPageController,childrenDelegate  SliverChildListDelegate(children),super(key: key);2.2 PageController的源码 
PageController({this.initialPage  0,//初始化第一次默认在第几个this.keepPage  true,//是否保存当前 Page 的状态如果保存下次回复对应保存的 pageinitialPage被忽略如果为 false 。下次总是从 initialPage 开始this.viewportFraction  1.0,//占屏幕多少1为占满整个屏幕}) : assert(initialPage ! null),assert(keepPage ! null),assert(viewportFraction ! null),assert(viewportFraction  0.0);简单demo 
return MaterialApp(home: Scaffold(appBar: AppBar(title: Text(PageView学习),),body: Center(child: PageView(scrollDirection: Axis.horizontal,reverse: false,controller: PageController(initialPage: 1,keepPage: false,viewportFraction: 0.8),children: [Container(color: Colors.red,child: Text(我是页面0),),Container(color: Colors.blue,child: Text(我是页面1),),Container(color: Colors.green,child: Text(我是页面2))],),),),);