Flutter 可排序拖放 ListView [英] Flutter Sortable Drag And Drop ListView

查看:21
本文介绍了Flutter 可排序拖放 ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我开始学习 Flutter 并希望使用 Material Design 拖放列表,就像在材料指南网站上看到的一样.

So I'm starting to learn Flutter and would like to use a material design drag and drop list just like the one seen on the material guidelines website.

https://storage.googleapis.com/spec-host-backup/mio-design%2Fassets%2F1dtprsH4jZ2nOnjBCJeJXd7n4U-jmWyas%2F03-list-reorder.mp4

与此相比,我迄今为止尝试过的所有库看起来都像垃圾.是否有我缺少的好库或原生 Flutter 小部件?

All of the libraries I have tried out so far look like garbage compared to that. Is there a good library for this that I am missing or a native Flutter widget?

推荐答案

检查 knopp/flutter_reorderable_list.它做到了这一点.它真的很流畅,没有性能问题,能够处理数千个项目.

Check knopp/flutter_reorderable_list. It accomplishes just that. It's really smooth and it's got no performance issues, being able to handle thousands of items.

然而,它的实现并不像通常的 Flutter 小部件那样容易.

However, it's implementation is not easy as usual flutter widgets.

如果您对此感到挣扎,我建议您使用我创建的小部件将 flutter/ReorderableListView 移植到 knopp/ReorderableList.

If you struggle with that, I'd recommend you to use a widget I created to port flutter/ReorderableListViews to the knopp/ReorderableList.

这个小部件使它非常易于使用,但是它没有提供同样的灵活性,并且由于它与 children List 一起使用,它不像原来的.

This widget makes it really easy to use, however it doesn't provide the same flexibility, and as it works with a children List, it's not as scalable as the original.

这是 ReorderableListSimple 的代码,这是演示.

Here's the code for ReorderableListSimple and this is the demo.

这篇关于Flutter 可排序拖放 ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆