有没有办法在Flutter 中使用PageView来实现无限循环?例如,如果我的PageView有5页,在滑动到第5页后,我将能够再次以相同的方向滑动到第1页.
有没有办法在Flutter 中使用PageView来实现无限循环?例如,如果我的PageView有5页,在滑动到第5页后,我将能够再次以相同的方向滑动到第1页.
默认情况下,PageView.builder
是无限Flutter .除非你提供itemCount
分.
下面将无限打印从0到4的页面
final controller = new PageController(initialPage: 999);
...
new PageView.builder(
controller: controller,
itemBuilder: (context, index) {
return new Center(
child: new Text('${index % 5}'),
);
},
)