-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReorderableGridView with shrinkWrap expands vertically when reordering, if last row is 'full' #15
Comments
I'm aware of this, it is somewhat of a "hack" to make extend work properly. there might be a better way to do this but I haven't found one yet. @override
Widget build(BuildContext context) {
assert(debugCheckHasOverlay(context));
final SliverChildBuilderDelegate childrenDelegate =
SliverChildBuilderDelegate(
_itemBuilder,
// When dragging, the dragged item is still in the grid but has been replaced
// by a zero height SizedBox, so that the gap can move around. To make the
// grid extent stable we add a dummy entry to the end.
childCount: widget.itemCount + (_dragInfo != null ? 1 : 0),
);
return SliverGrid(
delegate: childrenDelegate,
gridDelegate: widget.gridDelegate,
);
} |
@casvanluijtelaar I'm not sure precisely how the logic in the package works, but I don't see why the following wouldn't work without side effects:
Is this similar to how the current code works? Maybe the current code can be changed to this with little effort? I tried updating the parts of it that I could decipher to follow this logic, but it has some effects that I couldn't understand, given that I don't understand the overall design. |
Out of curiosity, has a fix for this been found yet? I have been running into the same issue in my project and NEED a solution. I am willing to work on one myself as well if one has not yet been found. |
I am not aware of an existing fix. I think the strategy in #15 (comment) should work, but I didn't have time to figure out the overall design of the package. |
I haven't looked into it much, it could potentially be fixed with some conditional logic ontop of the current implementation. for example only adding a new row when the drag position is on the last item etc |
I believe #17 fixes this. Please test it and let me know! |
fixed in 1.0.6 |
If a
ReorderableGridView.extent
hasshrinkWrap
set to true, and the last row is full of items, then an extra row is added to the grid view when reordering is started:reorderable_shrinkwrap_bug.mp4
This does not happen if the last row is not full. I would expect it not to happen in general.
Thanks again!
The text was updated successfully, but these errors were encountered: