Automatically resize Flutter TextFormField content as the user is typing while keeping maxLines equal to 1


I am using TextFormField in my Flutter app to get the email address of users. Some email addresses are long and so, if I keep typing, it will go out of the box. See how the first few letters of the email in the image below are outside the box.

enter image description here

Below is the code (just a simple TextFormField). I want the text to automatically resize while remaining in one line and also I can see all the text. Is there a way to do that?

    width: ScreenUtil().setWidth(407),
    height: ScreenUtil().setHeight(69),
    child: TextFormField(
      autocorrect: false,
      textCapitalization: TextCapitalization.none,
      keyboardType: TextInputType.emailAddress,


Use auto_size_text_field package

  controller: _textEditingController,
  style: TextStyle(fontSize: 20),
  maxLines: 1,

Answered By – AzerSD

Answer Checked By – Katrina (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *