oividiosCaeremos
oividiosCaeremos

Reputation: 728

TextField input always starts uppercase

In my Flutter app, even though I add textCapitalization: TextCapitalization.none to the TextField and its keyboardType is TextInputType.emailAddress, the text field always starts with an uppercase character when I start typing. I have to manually turn off uppercase from my keyboard. And quite frankly I don't want it to happen like that. How can I solve this problem?

My Widget:

Widget build(BuildContext context) {
    return Container(
      child: TextField(
        onChanged: function(),
        obscureText: this.hintText == "Password" ? true : false,
        keyboardType: this.keyboardType,
        textCapitalization: TextCapitalization.none,
        decoration: InputDecoration(
          hintText: this.hintText,
          contentPadding:
              EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
          border: OutlineInputBorder(
            borderRadius: BorderRadius.all(Radius.circular(32.0)),
          ),
          enabledBorder: OutlineInputBorder(
            borderSide: BorderSide(color: _colorPalette.darkBlue, width: 1.0),
            borderRadius: BorderRadius.all(Radius.circular(this.size)),
          ),
          focusedBorder: OutlineInputBorder(
            borderSide: BorderSide(color: _colorPalette.darkBlue, width: 2.0),
            borderRadius: BorderRadius.all(Radius.circular(this.size)),
          ),
        ),
      ),
    );
  }

Upvotes: 2

Views: 1519

Answers (1)

Yster
Yster

Reputation: 3305

The following code always gives lower case for me:

TextField(
  keyboardType: TextInputType.emailAddress,
  textCapitalization: TextCapitalization.none,
),

Even if I leave out any or both of the two statements inside the TextField!

I guess you're testing on a real device. Maybe it's your keyboad: I'm using Gboard.

Upvotes: 2

Related Questions