TextFormField without underscore when typing

1,450 views
Skip to first unread message

Laban

unread,
Oct 16, 2019, 4:21:14 PM10/16/19
to Flutter Development (flutter-dev)
Hi,

I am new to Flutter and was hoping to find out how to disable the underscore when typing text using a TextFormField:

TextFormField-underscore.jpg




Here is the widget that I use (basically a TextFormField with some default properties set):
@override
  Widget build(BuildContext context) {
    return Container(
      child: TextFormField(
        maxLength: 25,
        initialValue: _initialValue,
        enabled: _enabled,
        readOnly: _readOnly,
        inputFormatters: <TextInputFormatter> [UpperCaseTextFormatter()],
        style: TextStyle(fontSize: 17),
        decoration: InputDecoration(
          labelText: _labelText,
          hintText: _labelText,
          filled: true,
          fillColor: Colors.white,
          contentPadding: new EdgeInsets.symmetric(vertical: 10, horizontal: 10),
          border: OutlineInputBorder(),
        ),
      ),
    );


Here is the MaterialApp at the root with the ThemeData:
@override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () async => false,
      child: MaterialApp(
        title: 'SomeApp',
        debugShowCheckedModeBanner: false,
        theme: ThemeData(
            primarySwatch: Colors.blue,
            disabledColor: Colors.black,
            inputDecorationTheme: InputDecorationTheme(
              border: OutlineInputBorder(),
              contentPadding: EdgeInsets.symmetric(
                vertical: 22,
                horizontal: 26,
              ),
              labelStyle: TextStyle(
                fontSize: 17,
                decorationColor: Colors.red,
              ),
            )),
        home: LoginPage(),
        routes: routes,
      ),
    );
  }
}


Thanks.


Justin McCandless

unread,
Oct 17, 2019, 12:20:59 PM10/17/19
to Laban, Flutter Development (flutter-dev)
What keyboard are you using?  I wonder if it's the keyboard trying to suggest ways to complete the word.  Maybe try turning off the autocorrect property in your TextField?


Justin


--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/7394ca7d-82dd-43a1-9858-10df1d6d3ef8%40googlegroups.com.

Lars Oberg

unread,
Oct 17, 2019, 12:57:56 PM10/17/19
to Justin McCandless, Flutter Development (flutter-dev)
Justin,

I thought I had fully turned that off (under Languages & Input, Input assistance, etc.), but I had another look and found one setting screen that I had missed entirely (see below).  After turning off "Show suggestion strip". etc., the underline finally went away!

Thanks for your help!

image.png

Justin McCandless

unread,
Oct 17, 2019, 1:12:32 PM10/17/19
to Lars Oberg, Flutter Development (flutter-dev)
Ah good to know.  No problem!


Justin
Reply all
Reply to author
Forward
0 new messages