Flutter Dart – Disable Word Underlining in TextFormField

dartflutter

I am currently working on an app design in Flutter, and struggling with this seemingly easy problem. When creating the TextFormField below, the input text is always underlined, no matter of what I've tried. The only thing I want is text without this ugly underline.

Possibly the reason for this issue is that Android (I'm using an Android Emulator) automatically underlines text in input forms like this one, but this is just a thought that came to my mind and I am not sure if this is the real reason behind my struggle with the TextFormField. Anyway, here is my code and what I get.

Here is how my TextFormField looks at the moment

Container(
              margin: EdgeInsets.only(top: 10, left: 20, right: 30),
              child: Card(
                  elevation: 5.0,
                  child: Container(
                    child: TextFormField(
                      style: TextStyle(
                          fontSize: 18.0,
                          color: const Color(0xFF757575),
                          decoration: TextDecoration.none,
                          fontWeight: FontWeight.w500,
                          fontFamily: 'Montserrat'),
                      key: formKey,
                      onSaved: (text) => _input = text,
                      decoration: InputDecoration(
                        focusedBorder: InputBorder.none,
                        enabledBorder: InputBorder.none,
                        border: InputBorder.none,
                        prefixIcon: Icon(
                          Feather.getIconData("search"),
                          color: Colors.orange,
                        ),
                      ),
                    ),
                  ))),

Best Answer

This is done by the keyboard you are using on Android automatically.

For users who have disabled text correction, this will not show up.

On an Android emulator you can turn it off in the keyboard settings: Settings -> System -> Languages & Input -> Virtual Keyboard -> Gboard -> Text correction.
The specific settings you are looking for are Show suggestion strip and Auto-correction. If you turn these off, you will not be seeing the underlining anymore.

Flutter

Having said that, this is not related to Flutter and you should probably not turn off "this ugly underline" as users expect to have this functionality.
You could probably work about it by using SelectableText widgets instead and manually recording the keyboard input, however, there is not really a point to do that and you would get functionality that does not feel familiar to your users.

Related Question