Closed fehernyul closed 4 years ago
I solved my problem with rewrite the original code at "class _ReorderableItemState" from this:
@override void didUpdateWidget(ReorderableItem oldWidget) { super.didUpdateWidget(oldWidget);
_listState = _ReorderableListState.of(context);
if (_listState.dragging == this.key) {
_listState._draggedItemWidgetUpdated();
}
}
to this:
@override void didUpdateWidget(ReorderableItem oldWidget) { super.didUpdateWidget(oldWidget);
_listState = _ReorderableListState.of(context);
if (_listState.dragging != null) {
_listState._draggedItemWidgetUpdated();
}
}
Hi,
My use case is: some item allow to drag to anywhere, but soem otem not to drag anywhere, only between concrete interval, otherwise it will be "locked".
I use the "_reorderCallback" to determine which item allow to drag to the newIndex and which is not to drag there. I want to show to user, wheret can drag the item and where cannot to. If the newIndex's place is prohibited, then I want to draw the handle with a Cancellation icon with red, and where allow, the Icon stay the normal/previous.
My problem is: when I drag an item to a restricted position, the handle icon will red-cancellation icon but - without dropping the item - I drag back to a good place, the handle icon not drawing/changing back to the normal icon. Can you help my correct my code, please?
main.dart.txt