Repository navigation
feat: TextField.text_input_action to choose the action button of the mobile onscreen keyboard - #7021
Merged
Conversation
TextField and CupertinoTextField always used the platform's default keyboard action, so a form couldn't offer "Next" to move to the next field with the keyboard open. `text_input_action` takes the new TextInputAction enum and is passed to Flutter's textInputAction; None keeps the platform default.
…ample Device tests on the iOS Simulator and an Android emulator showed what the enum docs left out: an action the platform doesn't support leaves a debug build's field without a keyboard and reports no error, CONTINUE_ACTION, JOIN, ROUTE, EMERGENCY_CALL and UNSPECIFIED keep focus and the keyboard open, and NONE on Android removes focus. Platform-only actions now say so in a Note. The new keyboard_actions example chains a form with NEXT and sends it with SEND. It is shown on the TextField and TextInputAction pages.
TextField.text_input_action to choose the action button of the mobile onscreen keyboard
Deploying flet-website-v2 with
|
| Latest commit: |
4190d4e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bec3846a.flet-website-v2.pages.dev |
| Branch Preview URL: | https://feat-textfield-text-input-ac.flet-website-v2.pages.dev |
1 task done
FeodorFitsner
approved these changes
Oct 29, 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.
Fixes #6962.
On a phone, a single-line
TextFieldalways shows Done on the keyboard, and pressing it closes the keyboard. Moving to the next field fromon_submitwithfocus()can't avoid that: by the time the call comes back from Python, Flutter has already dropped focus and is hiding the keyboard, so it closes and reopens on every field.This adds
text_input_actiontoTextFieldandCupertinoTextField, with aTextInputActionenum that mirrors Flutter's. WithNEXT, Flutter moves focus to the next field in the same frame, so the keyboard stays open, andon_submitstill fires:When it isn't set, fields behave as before: Done on single-line fields, a new line on multiline ones.
Changes
TextInputActionenum andTextField.text_input_action. The field is keyword-only, so the positional arguments ofTextFieldand its subclassCupertinoTextFielddon't shift.parseTextInputAction()/Control.getTextInputAction(), passed toTextFormFieldandCupertinoTextField.keyboard_actionsexample is shown on theTextFieldandTextInputActionpages.Testing
Tested with a probe app on the iOS Simulator (iOS 26.5, debug build) and an Android 16 emulator (release APK):
NEXTmoves focus with the keyboard open the whole time (checked on every frame of a screen recording on iOS, and by polling the IME state on Android), andon_submitfires.DONE,GO,SEARCHandSENDclose the keyboard afteron_submit, and each shows its own key.PREVIOUS(Android),CupertinoTextField, multiline fields (no new line and noon_submitwithDONE/NEXT), and changing the action at runtime (applies on the next focus) all behave as documented.Web was tested earlier in headless Chromium: the browser gets the matching
enterkeyhint, andEnterperforms the action.Things worth knowing
PREVIOUSon iOS) leaves the field focused with no keyboard and no error. Android release builds fall back to the default key. This is documented on the enum.NEXTfollows reading order, so a focusablesuffixbutton gets focus before the next field. Flet has no way to take a button out of focus traversal, so that would be a separate feature.on_submit, because Flet only wires it for single-line fields. That predates this change.Summary by Sourcery
Enable configurable onscreen keyboard actions for text fields, including seamless focus chaining between form fields.
New Features:
Enhancements:
Documentation: