Avoid flickering while dragging to select text#29563
Conversation
|
The CI are all flakes. Restarted |
There was a problem hiding this comment.
tott/510.md
Don't do redirections, just put numbers in, e.g. base 4, extent 9 directly.
There was a problem hiding this comment.
Add this test in cupertino/text_field_test.dart too
There was a problem hiding this comment.
Add this test to material and cupertino text_field_test too via gestures (in case we move those widgets to use something else than selectPositionAt in the future).
There was a problem hiding this comment.
Added the test to material for now. Cupertino still doesn't have text selection via mouse but I'll have a PR for that tomorrow.
There was a problem hiding this comment.
Is this a mouse specific issue or would this not happen with a handle drag?
There was a problem hiding this comment.
@xster yes, for some reason dragging the handles doesn't flicker at all.
That said, your comment made me think about other scenarios that may cause flickering, and I found one :) Long-press-drag has the same issue in the material text field. But it's not fixed by this PR. Filed an issue here to be fixed separately: #29682.
24db79f to
b1e9d96
Compare
|
LGTM. Thanks! |
b1e9d96 to
b5d5fa6
Compare
When dragging to select text, we continuously call
onSelectionChangedwhich causes the selection box and handles to be repainted. This causes unnecessary flickering to happen.The solution in this PR is to avoid calling
onSelectionChangedif the new selection is the same as the existing one.Another unrelated change is the addition of tests addressing @xster comment in #29395. As part of that, I found out that the existing
drag handles ...test was notexpecting the right thing.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?