class _DemoPageState extends State<DemoPage> {
@override
Widget build(BuildContext context) {
return Container(
height: 400.0,
child: PageView(
//滚动方向
scrollDirection: Axis.vertical,
//页面滚动时触发
onPageChanged: (int index){
},
children: [
Container(
color: Colors.red,
child: Center(
child: Text('第一页',style: TextStyle(color: Colors.white),),
),
),
Container(
color: Colors.red,
child: Center(
child: Text('第二页',style: TextStyle(color: Colors.white),),
),
),
Container(
color: Colors.red,
child: Center(
child: Text('第三页',style: TextStyle(color: Colors.white),),
),
),
],
),
);
}
}
Flutter笔记41:PageView滚动组件
PageView滚动组件,支持左右滚动和上下滚动,滚动回调等,一个最简单的页面滚动组件
