标签: reorderable-list

是否可以在颤振中禁用可重新排序列表视图中的单个项目的重新排序?

我正在尝试创建一个满足以下条件的 ListView:

  1. ListView 中的项目分为几个部分,每个部分都有标题
  2. 可以将项目从一个部分拖动到另一部分
  3. 节标题不可拖动

如果ReorderableListView允许您禁用 ListTile 被拖放(换句话说,我将能够在 ListView 中将标题创建为 ListTile 项,并仅禁用它们的拖放,同时仍然允许其他所有内容),那么这将很容易实现被拖放),但我不知道如何。有小费吗?

listview drag-and-drop reorderlist flutter reorderable-list

13
推荐指数
2
解决办法
4513
查看次数

Flutter ReorderableListView 中的 onReorder() 参数

我尝试使用 ReorderableListView 小部件在 Flutter 中创建一个可重新排序的列表

return ReorderableListView(
    onReorder: (int index, int targetPosition) {
        print(index.toString() + " -> " + targetPosition.toString());
    }
...
Run Code Online (Sandbox Code Playgroud)

我找不到 onReorder 中的两个参数的确切解释。我找到了一些“oldIndex”、“newIndex”员工——但这看起来并不正确。

我已经用一个包含三个项目的列表构建了一个示例。当我拖动项目时,我得到以下(让我感到困惑)结果:

Position 1 -> Position 2 results in 0 -> 2
Position 1 -> Position 3 results in 0 -> 3
Position 3 -> Position 1 results in 2 -> 1
Run Code Online (Sandbox Code Playgroud)

对我来说,它看起来像是索引和位置的混合......

也许有人知道我的错误是什么?

dart flutter reorderable-list

9
推荐指数
2
解决办法
3542
查看次数

删除从 ReorderableListView 中拖动项目时出现的阴影(Flutter)

在我的 TODO 应用程序中,我ListaItem使用ReorderableListView. 问题是,ListaItem当我尝试拖动它们时,我的边框有圆形边框,并且会出现矩形(且丑陋)的阴影。

我的目标是消除这个烦人的阴影。

我的ListaItem应该是这样的:

在此输入图像描述

在此输入图像描述

这里的ListaItem代码:

 @override
 Widget build(BuildContext context) {
   return 
       Container(
         margin: EdgeInsets.only(left:10.0, right: 10.0, top: 7,bottom: 7),
         decoration: BoxDecoration(
           boxShadow: [BoxShadow(
               color: Color.fromRGBO(50, 50, 50, 0.21),
               offset: Offset(2, 2),
               blurRadius: 10.0
             )],
             borderRadius: BorderRadius.all(Radius.circular(100.0))
         ),
         child: ElevatedButton(
           onPressed: () {
             setState(() {
               widget.checkValue = !widget.checkValue;
             });
           }, 
           style: ElevatedButton.styleFrom(
             primary: Colors.white,
             onPrimary: Color.fromARGB(0, 59, 59, 59),
             shape: StadiumBorder(),             
           ),
           child: AnimatedContainer(
             duration: Duration(milliseconds: 100),
             height: 55, …
Run Code Online (Sandbox Code Playgroud)

draggable dart flutter reorderable-list

6
推荐指数
1
解决办法
1496
查看次数

扑。如何对重新排序的 ListView 进行动画处理?

是否可以像 ReorderableListView 一样对 ListView 的顺序更改进行动画处理,但无需用户交互。

例如,意味着几秒钟后 ListView 的顺序会发生变化。所以我有两个包含相同项目但顺序不同的列表。列表一和列表二。

我已经看到了 AnimatedList,但在那里我可以删除或添加动画。我需要像移动动画这样的东西。

有点像 ReorderableListView,但没有用户交互。或者是否可以在 ReorderableListView 中以编程方式替换用户交互?

提前致谢

listview dart flutter flutter-animatedlist reorderable-list

5
推荐指数
0
解决办法
568
查看次数