首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Flutter Draggable和ReorderableListView

Flutter Draggable和ReorderableListView
EN

Stack Overflow用户
提问于 2021-05-19 07:03:40
回答 1查看 52关注 0票数 0

我需要创建一个列表,它应该能够重新排序,但我也应该能够删除一个项目,如果拖到一个特定的拖动目标。现在,我已经在两个不同的屏幕中合并了这两个功能。一个使用ReorderabelListView,另一个使用Draggable。有没有办法把两者结合起来?

EN

回答 1

Stack Overflow用户

发布于 2021-05-19 10:28:33

您可以使用reorderables plugin完成此操作

代码语言:javascript
复制
ReorderableColumn(
  onReorder: (oldIndex, newIndex) {

  },
  children: someList.map((item) {
    final index = someList.indexOf(item);

    return Dismissible(
      key: ObjectKey(item),
      onDismissed: (direction) {

      },
      background: Container(color: Colors.red),
      child: Container(),
    );
  }).toList(),
);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67594995

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档