Repository navigation
feat: honor TextField text_input_action keyboard actions - #14
Merged
Merged
Conversation
Read the Ruby text_input_action keyword on both TextField renderers and pass it to TextFormField/CupertinoTextField. Values accept camelCase or snake_case and are sanitized for the device keyboard (Flutter asserts on actions a platform does not support), so unsupported actions fall back to the platform default. next/previous use Flutter's default focus traversal and still fire submit. A multiline field with an explicit action such as done now submits on Return instead of inserting a newline.
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ruby counterpart: AdamMusa/ruflet#30
What
TextField now honors the Ruby
text_input_actionkeyword: it picks the soft keyboard's return key (Done, Next, Send, Search, ...) and, through Flutter's default editing-complete behavior, moves focus to the next or previous field.Wire keys and events
text_input_actionTextInputActionnames case-insensitively. camelCase or snake_case both work (continueAction/continue_action). Absent or unknown values keep the platform default.submit(unchanged)next/previous.Supported values:
done go search send next previous newline unspecified none continueAction join route emergencyCall.Material vs Cupertino
TextFormField) and Cupertino (CupertinoTextField) both receive the parsed action.defaultTargetPlatform), not the page's design platform. A page can force the Cupertino design on an Android phone, but the Android keyboard still asserts on iOS-only actions. Unsupported actions becomenull(platform default), mirroring Flutter's lists inservices/text_input.dart:continueAction join route emergencyCall.none previous.onEditingCompleteis intentionally not set, so Flutter's default handles focus:nextcallsnextFocus(),previouscallspreviousFocus(), other actions unfocus.onSubmittedstill runs, so Ruby'son_submitfires.multiline: trueplus an explicit ending action (anything exceptnewline/unspecified/none) now submits on Return instead of inserting a newline. This matches iOS, where a non-default return key sends the action rather than\n. Withouttext_input_action, multiline fields behave as before (Return inserts a newline, no submit).Changes
utils/input.dart:parseTextInputAction(String?, TargetPlatform)(strips underscores per SPEC R4, filters by platform),textInputActionEndsMultilineEditing,Control.getTextInputAction. The file stays import-neutral (foundation/services/widgets only).controls/textfield.dart,controls/cupertino_textfield.dart: passtextInputAction; keep the submit callback for multiline fields with an ending action.Tests
test/widgets/ruby_text_input_action_test.dart(9 tests, run on iOS and Android viaTargetPlatformVariant):CupertinoTextFieldon iOS andTextFieldon Android:nextmoves focus from field A to B. A firessubmit("[email protected]")andblur, B firesfocus. Thendoneon B unfocuses it and firessubmit("secret").EditableText.textInputActionforprevious,join,emergency_callandSearch, plusnullwhen the key is absent.donesubmits the text without inserting a newline. Multiline without an action never submits onnewline.previousmoves focus back to the preceding field and submits.verify_pr.sh(Flutter 3.41.2), run together with the Ruby PR: