In Android and iOS it is possible to change the enter/return key of the keyboard to e.g. a "Go" button (and other options).
On top, we can see the regular "Return" button on both systems, which is the one you get by default with no modifications in both Android & iOS native and Flutter.
Below that, there is another setting, again on both systems, which you can simply adjust in your native application. It is the "Go" button in this case.
The term TextInputAction. newline exists in Flutter but not in Android or iOS. The reason for introducing this term is so that developers can achieve the common result of inserting new lines without needing to understand the various IME actions on Android and return keys on iOS. Thus, TextInputAction.
Reading input value In Flutter, this can be done using TextEditingController . First, create a TextEditingController and set it as a controller property of your TextField widget. In this example, I have added an extra Button and Text widget which will show the added text when you click the “Show Text” button.
The input action for a TextField
(or TextFormField
) can be specified like this (here, the Go button):
TextField( textInputAction: TextInputAction.go ... )
List of all available input actions.
This is how you can use textInputAction
:
TextField( textInputAction: TextInputAction.search, onSubmitted: (value) { print("search"); }, decoration: InputDecoration( border: InputBorder.none, prefixIcon: Icon(Icons.search), hintText: 'Search ', contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0), ), );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With