Reputation: 697
I want to disable predictive text which comes in the keyboard of a textfield. It is not so difficult in native android and IOS but I have not found a solution in a Flutter.
I have tried using autocorrect: false and changing keyboardtypes but it is not working.
TextField(
autocorrect: false,
keyboardType: TextInputType.emailAddress,
decoration: new InputDecoration(hintText: "Enter text"),
autofocus: true,
),
Upvotes: 42
Views: 30047
Reputation: 1
i tried this and it's solved
TextField(
...
enableSuggestions: false,
enableIMEPersonalizedLearning: false,
...
),
Upvotes: -1
Reputation: 20158
If neither enableSuggestions
nor autocorrect
can solve the problem, try setting keyboardType
to TextInputType.visiblePassword.
Upvotes: 50
Reputation: 1148
You can try to add enableSuggestions = false
to your textfield widget. This should disable the predictive text from your keyboard as supposed to https://github.com/flutter/flutter/pull/42550.
TextField(
autocorrect: false,
enableSuggestions: false,
keyboardType: TextInputType.emailAddress,
decoration: new InputDecoration(hintText: "Enter text"),
autofocus: true,
),
Upvotes: 25
Reputation: 2284
This worked for me on both iOS and android
TextField(
autocorrect: false,
obscureText: true,
controller: answerText,
textAlign: TextAlign.center,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.done,
autofocus: true,
onChanged: (value) {
setState(() {
result = value;
});
},),
The only downside is that it obscure from the screen what is written. A workaround is to add somewhere in the screen Text(result)
Upvotes: 4
Reputation: 1722
At the time of writing this answer, this is not yet available in Android. But using autocorrect: false on iOS should work fine.
Check: https://github.com/flutter/flutter/issues/22828
Upvotes: 4