小编Ale*_*ues的帖子

如何在 Flutter 中使用 ReorderableListView 和 DismissDirection?

我需要在我的重新排序列表中包含使用滑动删除项目的选项。问题是 ReorderableListView 小部件收到一个列表,因此我无法添加 Dismissible() 小部件。有什么办法可以解决这个问题吗?

  Widget _buildReorderableListSimple(BuildContext context) {
    return ReorderableListView(
      onReorder: _onReorder,
      children: _getListItems(),
    );
  }

 List<ListTile> _getListItems() => _items
      .map(
        (Song item) => _buildTenableListTile(context, item),
      )
      .toList();

  ListTile _buildTenableListTile(Song item, int index) {
    return ListTile(
      key: ValueKey(item.songId),
      title: new Text(
        '${item.sequence}. ${item.name}',
        style: TextStyle(
          color: Colors.black,
          fontWeight: FontWeight.bold,
        ),
      ),
      subtitle: new Text(
        '${item.artist} ${item.songId}',
        style: TextStyle(
          color: Colors.black,
        ),
      ),
      onTap: () {

      },
    );
  }
Run Code Online (Sandbox Code Playgroud)

flutter

2
推荐指数
1
解决办法
2759
查看次数

标签 统计

flutter ×1