【问题标题】:Flutter Draggable and ReorderableListViewFlutter Draggable 和 ReorderableListView
【发布时间】:2021-08-08 05:01:22
【问题描述】:

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

【问题讨论】:

    标签: flutter flutter-layout


    【解决方案1】:

    你可以通过reorderables plugin来实现

    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(),
    );
    

    【讨论】:

      猜你喜欢
      • 2022-11-15
      • 2019-06-07
      • 2020-10-12
      • 1970-01-01
      • 2020-08-13
      • 1970-01-01
      • 1970-01-01
      • 2020-08-02
      • 1970-01-01
      相关资源
      最近更新 更多