| 属性 | 说明 |
| :-: | :-: |
| horizontal | 水平方向滚动 |
| vertical | 垂直方向滚动 |
physics②
| 属性 | 说明 |
| :-: | :-: |
| AlwaysScrollableScrollPhysics | 总是可以滑动 |
| NeverScrollableScrollPhysics | 禁止滚动 |
| BouncingScrollPhysics | 内容超过一屏 上拉有回弹效果 |
| ClampingScrollPhysics | 包裹内容 不会有回弹 |
3.1 代码
ListView(
children: List.generate(10, (position) {
return Container(
alignment: Alignment.center,
height: 80,
color: Colors.primaries[position % Colors.primaries.length],
child: Text(“$position”),
);}),
)
3.2 效果图
<