-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Add draggable parameter to ReorderableDragStartListener #81396
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
Add draggable parameter to ReorderableDragStartListener #81396
Conversation
Please let me know if I missed something |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for the contribution! I totally missed this use case when I was developing the drag listeners.
I have a few comments and suggestions below that will need to be addressed before we can merge this, but otherwise this looks good. Thanks for including tests.
Let me know if there is anything that isn't clear, or if you aren't interested in taking this further. Thanks again.
…arameter # Conflicts: # packages/flutter/test/widgets/reorderable_list_test.dart
@darrenaustin I applied the changes you requested, let me know if I should do something more. Also, I am a bit confused:
I tried to investigate why I was having these different behaviours but I didn't found anything. await expectLater(find.byType(ReorderableListView), matchesGoldenFile('golden.png')); doesn't generate any image. Do you have an explanation or could you highlight me on how to debug/investigate the test runs ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@darrenaustin I applied the changes you requested, let me know if I should do something more.
Looks good thanks. I have a small issue I missed the first time (see new comment). Also it looks like there is a merge conflict with what is on the master branch, so that will need to be resolved before we can land this.
Also, I am a bit confused:
- For the
ReorderableDragStartListener
tests, I have to drag theitem 0
toOffset(0, 150)
to reorder it at the second position.- For the
ReorderableDelayedDragStartListener
tests, I have to drag theitem 0
toOffset(0, 50)
to reorder it at the second position.
That is odd. I spent a bunch time looking into this and it appears to be a bug with the drag calculations on the very first drag update event. It will be off by the size of the gap, but only for the first update. The current tests that are based off of moving the item by 150 are incorrect, and should only need to move by 50. The reason it works fine for the delayed listener is that under the covers it generates two update events on the start of the drag, and the second one uses the correct calculation. I am looking into fixing this, but go ahead and use the values you have in your tests now and if this lands before I can fix it will update them with my fix. Thanks for pointing this out!
I tried to investigate why I was having these different behaviours but I didn't found anything.
I wanted to use golden images to have more information, but for some reasons, addingawait expectLater(find.byType(ReorderableListView), matchesGoldenFile('golden.png'));
This may not give you what you want here, text in golden images are just blocks of color to avoid font changes effecting golden tests. In addition you wouldn't be able to see the dragged item as it is in an overlay, so you would have to include the top level overlay to get the full image. All that said, when you run this with a new golden image it should have given you a directory where the generated images were.
…tart-listener/draggable-parameter # Conflicts: # packages/flutter/test/widgets/reorderable_list_test.dart
Thank you for all those precisions and feedbacks @darrenaustin! I applied your requests changes. I hope everything is fine now :) Also it looks like the windows tests are failing (" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it was an infra problem on the test machines. I have restarted the tests and hopefully they will go through this time. |
Ok, good to know, let me know if I can do something else. |
Hi @ValentinVignal, there is still a windows test that is not passing, but I think it is a test that has been updated or turned off on the master branch. Can you pull in the latest from master and rebase your stuff on top of it? I think that will finally allow us to land this. Thx. |
…tart-listener/draggable-parameter
Hello @darrenaustin it looks like the windows test is not failing anymore 👍 . Thank you for monitoring this. |
This PR is adding a parameter
draggable
to the widgetReorderableDragStartListener
. This allows the user to dynamically activate/deactivate the drag/drop behaviour for some items in theReorderableListView
without changing the tree structure ; and therefore losing the state of the the stateful widgets inside the items of the list.List which issues are fixed by this PR. You must list at least one issue.
#81395
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.