Flutter ListView 拖拽排序了解一下

本文介绍了Flutter中的ReorderableListView组件,用于实现列表项目的拖拽排序功能。通过示例代码展示了如何创建一个简单的拖拽排序列表,并在onReorder回调中处理数据的更新。同时,提到了结合ListView实现拖拽排序和删除的功能。
摘要由CSDN通过智能技术生成

前面我们对于 ListView 的操作讲过 Flutter 滑动删除最佳实践,那现在我们来了解一下 ListView 的拖拽排序。

效果如下:

640?wx_fmt=gif

ReorderableListView

想要达到如上效果,需使用该类,官网简介:

A list whose items the user can interactively reorder by dragging.

This class is appropriate for views with a small number of children because constructing the List[1] requires doing work for every child that could possibly be displayed in the list view instead of just those children that are actually visible.

All children[2] must have a key.

简单翻译如下:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值