Issue
Is it possible to communicate to the children of a ReorderableListView that a drag/reorder attempt has begun? I have a ReorderableListView with custom widget children (not ListTile widgets) and I would like to be able to update their view when one of them begins to be dragged. For example, in this case:
ReorderableListView(
onReorder: (oldIndex, newIndex) {},
children: [
_CustomWidget(0),
_CustomWidget(1),
_CustomWidget(2),
]
);
I'd like to reduce the opacity of _CustomWidget(0)
and _CustomWidget(2)
if _CustomWidget(1)
has begun to be dragged. I've tried using a GestureDetector
to determine if a widget is being dragged but that obviously absorbs the gesture and the ReorderableListView
no longer begins the drag.
Is there a way to either allow the dragged widget to recognize its being dragged, or have the ReorderableListView
somehow communicate to its parent when one of its children are being dragged?
Solution
Looks like there is a PR currently awaiting for approval which would help you achieve that !
https://github.com/flutter/flutter/pull/96049
Once it'll be merged, you'll be able to detect when the reorder has started in order to change the opacity of the other items.
If you don't want to wait for the PR to be merged, you can also add the fork with the modification to your project instead of the official ReorderableListview
Answered By - FDuhen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.