-
Notifications
You must be signed in to change notification settings - Fork 29.7k
EditableText should not allow horizontal scrolling on iOS #162841
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
EditableText should not allow horizontal scrolling on iOS #162841
Conversation
justinmc
left a comment
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
…2841) Fixes flutter#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 - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. --------- Co-authored-by: Renzo Olivares <[email protected]>
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
///).