add a draggedItemBuilder widget to support persistent state children #164
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a new
draggedItemBuilder
feature that resolves the GlobalKey issues described in #72. To persist the state of the children passed to widgets like ReorderableColumn and ReorderableRow, I was having issues with giving the children a GlobalKey or a GlobalObjectKey since the library internally wraps the children in a KeyedSubtree with a GlobalKey based on each child's Key.This meant that there was no way to make persistent state children, something that the referenced issue was looking to solve and that I needed for my own usage. The solution I found was to build a different widget when dragging the child using a dragged item builder, since I can then give the children a GlobalKey and make them have persistent state without conflicting with the dragged item, which can be built with a non-persistent Key.
In addition to solving the persistent children state problem I think it's also a handy feature to have in case there are any other customizations folks want to make to a draggable widget while it is actively being dragged.
I'm happy to clean up the feature and make changes as advised. Let me know what you think thanks!