31

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,
        ),
sk_462
  • 587
  • 1
  • 7
  • 16

4 Answers4

42

If neither enableSuggestions nor autocorrect can solve the problem, try setting keyboardType to TextInputType.visiblePassword.

Spatz
  • 18,640
  • 7
  • 62
  • 66
21

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,
    ),
Ali Türkay Avci
  • 1,038
  • 12
  • 12
4

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

Ny Regency
  • 1,620
  • 8
  • 25
  • 43
3

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)

M4trix Dev
  • 1,828
  • 3
  • 23
  • 48