Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter iOS Email Text Field Content Type

Tags:

ios

flutter

dart

I'm implementing a login screen in Flutter and I cannot set the Content-Type on an email text field. On an iOS app, the content type needs to be set in order for email addresses suggestions to display while editing.

Am I missing something or is this not yet supported?

  TextFormField(
    maxLines: 1,
    keyboardAppearance: Brightness.light,
    keyboardType: TextInputType.emailAddress,
    textInputAction: TextInputAction.next,
    focusNode: _emailFocus,
    autofocus: true,
    decoration: InputDecoration(
      hintText: 'Email',
      icon: Icon(
        Icons.mail,
        color: Colors.grey,
      ),
    ),
    validator: (value) => value.isEmpty ? "Email can't be empty" : null,
    onSaved: (value) => _email = value.trim(),
    onFieldSubmitted: (term) => _fieldFocusChange(context, _emailFocus, _passwordFocus),
  )

There is an option for this in Xcode: xcode screen shot

like image 742
vincekruger Avatar asked Aug 04 '19 17:08

vincekruger


People also ask

What is the difference between text field and text form field in Flutter?

One is TextField and the other one is TextFormField , a slightly more advanced version of TextField . TextFormField provides more functionalities than TextField , such as build form validation and the ability to set initial text value directly.


1 Answers

There is a keyboardType

new TextFormField
 (
   keyboardType: TextInputType.emailAddress
   ...
)
like image 161
hasanaydogar Avatar answered Oct 26 '22 23:10

hasanaydogar