mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
## Description This PR prevents new line key event from being dispatched for a multiline text field when `TextField.textInputAction` is not `TextInputAction.newline`. Since https://github.com/flutter/engine/pull/33428, web engine does not prevent new line key events. In https://github.com/flutter/engine/pull/36893, I fixed a similar issue for single line text fields. At that time I was not sure if we want to fix it for multiline text fields. I checked again on non-web platforms (macos, iOS, Android) and the new line is not added if the input action is not `TextInputAction.newline`. For a **multiline field**, the default text input action is `TextInputAction.newline`. If the developer sets text input action to another value: - before this PR, the action is performed and a new line is added. - after this PR, the action is performed but no new line is added. ## Related Issue Fixes https://github.com/flutter/flutter/issues/145051 ## Tests Adds 1 tests, updates 3 tests.