EditableText should not allow horizontal scrolling on iOS#162841
Conversation
justinmc
left a comment
There was a problem hiding this comment.
LGTM 👍 . Solid simple fix, we should have done something like this a long time ago.
| } | ||
|
|
||
| class _NeverUserScrollableScrollPhysics extends ScrollPhysics { | ||
| /// Creates scroll physics that does not let the user scroll, but allows for programatic scrolling. |
There was a problem hiding this comment.
Nit: Maybe say that it does not let the user scroll "by dragging" or "by panning" to be more specific? Or maybe I'm being too pedantic.
| ); | ||
|
|
||
| testWidgets( | ||
| 'single-line field cannot be scroll with touch on iOS', |
There was a problem hiding this comment.
Nit "be scroll" => "be scrolled"
| physics: widget.scrollPhysics, | ||
| // On iOS a single-line TextField should not scroll. | ||
| physics: | ||
| widget.scrollPhysics ?? |
There was a problem hiding this comment.
I'm glad this is overridable if the developer still wants to enable scrolling 👍
| axisDirection: _isMultiline ? AxisDirection.down : AxisDirection.right, | ||
| controller: _scrollController, | ||
| physics: widget.scrollPhysics, | ||
| // On iOS a single-line TextField should not scroll. |
There was a problem hiding this comment.
Good call explaining this.
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
46c1177 to
85567c7
Compare
d6112dd to
6d69ced
Compare
Fixes #25553
On iOS single-line TextFields are not scrollable with user input, for example a pan gesture to move the viewport. They can still be scrolled when the user drags the selection handles. Scrolling remains the same for multi-line TextFields. A user can override this by providing CupertinoTextField/TextField/EditableText with a custom
scrollPhysics.Pre-launch Checklist
///).