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.
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?
SizedBox(
width: ScreenUtil().setWidth(407),
height: ScreenUtil().setHeight(69),
child: TextFormField(
textAlign: TextAlign.center,
autocorrect: false,
textCapitalization: TextCapitalization.none,
keyboardType: TextInputType.emailAddress,
)
)
Use auto_size_text_field
package
AutoSizeTextField(
controller: _textEditingController,
style: TextStyle(fontSize: 20),
maxLines: 1,
)