'How to disable AUTO SUGGESTION in a Textfield in Flutter and other problems with KEYBOARDTYPE in IOS

Am working on a vocabulary learning app (from English to French and vice versa). When doing quizzes, I would prefer it if user didn't have suggestions on the suggestion bar (as it helps with spelling). I tried disabling options in the textfield, but nothing works. Here is the code :

Container(
           padding: const EdgeInsets.all(8),
            child: TextFormField(
              smartQuotesType: SmartQuotesType.disabled,
              autofocus: true,
              enableSuggestions: false,
              autocorrect: false,
              controller: fieldText,
              
              keyboardType:
                  TextInputType.visiblePassword,
              enabled: pasfini,
              enableInteractiveSelection: false,
              autovalidateMode:
                  AutovalidateMode.disabled,
              decoration: InputDecoration(
                  border: OutlineInputBorder(
                    borderRadius:
                        BorderRadius.circular(10.0),
                  ),
                  labelText: 'Ecris la traduction'),
              onChanged: (value) {
                word = value;
              },
              onTap: () {
                setState(() {
                  exoEnCours = true;
                });
              },
            ),
          ),

The only thing that seems to work is if I set keyboardType to email address... But in that case the space bar becomes very small and the @ sign appears...

I don't understand why the enableSuggestions : false and autocorrect : false do not work. It is specified in the API documentation that for IOS : AUTOCORRECT should be set to false for this to be disabled.

Do you know if there's a flutter bug ?

I tried to debug the same code on an ANDROID DEVICE, and it worked fine. There seems to be a problem with IOS....

I have the same problem with another option of the TEXTFIELD widget : the one linked with CAPITALIZATION.

TextFormField(
                    style: TextStyle(
                        fontSize: uD.device == Device.smallMobile
                            ? uD.smallFont2
                            : uD.mediumFont2),
                    initialValue: name,
                    keyboardType: TextInputType.name,
                    textCapitalization: TextCapitalization.words,
                    autocorrect: false,
                    enableSuggestions: false,
                    decoration: kTextFormFieldDecoration.copyWith(
                      labelText: 'Nom du responsable légal',
                    ),

It never capitalizes the first letter of the fieldText. It works fine on Android.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source