ScrollKit
ScrollKit 为 Flutter 应用中的列表提供了额外的功能。
特点
- [✓] 跳转到指定索引(int index)。
- [✓] 滚动到指定索引(int index)。
- [✓] 从领先和尾随方向加载列表内容。
- [✓] 重用列表项的 Element 和 RenderObject。
- [✓] 提供列表项的生命周期回调。
- [✓] 无需刷新整个列表即可加载更多列表项。
- [✓] 提供与刷新组件(SmartRefresher)兼容的跳转和滚动功能。
入门
scroll_kit: ^1.0.0
用法
final scrollView = CustomScrollView(
slivers: [
SKSliverList(
delegate: SKSliverChildBuilderDelegate((c, i) {
if (i % 2 == 0) {
return Container(
height: 100,
child: Text(i.toString()),
color: Colors.grey,
margin: EdgeInsets.only(top: 3),
);
} else {
return Container(
height: 100,
child: Text(i.toString()),
color: Colors.red,
margin: EdgeInsets.only(top: 3),
);
}
}, onAppear: (i) {
print("Appear: " + i.toString());
}, onDisAppear: (i) {
print("Disappear: " + i.toString());
}, reuseIdentifier: (i) {
if (i % 2 == 0) {
return "type1";
} else {
return "type2";
}
}, childCount: 100))
],
);
参考
贡献
- 本项目根据MIT License许可。
- 欢迎加入 字节跳动 Flutter 交流群。
- 如有任何问题或建议,请随时通过 [email protected] 联系我。