Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextField's input text cutting in half after getting full?

Screenshot of the problem

I am trying to add an Email, which is a long text, but when the text field got full it cut all text in half. here is my code:

        Container(
            height: 45,
            decoration: BoxDecoration(
            color: HexColor(MyColors.white),
            ),
            child: TextFormField(
            controller: _email,
            maxLength: 100,                        
           autofocus: true,
           validator: validateEmail,
           keyboardType: TextInputType.emailAddress,
           decoration: InputDecoration(
           labelText: 'Email',
           counterText: "",
           border: OutlineInputBorder(),
          ),
         ),
       ),
like image 272
Anil Pradhan Avatar asked Mar 07 '26 07:03

Anil Pradhan


2 Answers

I get your point.. your problem there is text got high up.. you can set

Just adjust the contentPadding top bottom so it can be centered

decoration: InputDecoration(
                 contentPadding:
                  const EdgeInsets.only(
                  left: 8.0,
                  bottom: 8.0,
                  top: 8.0)),```
like image 137
Raine Dale Holgado Avatar answered Mar 09 '26 20:03

Raine Dale Holgado


My problem get solved by adding those lines:

 maxLines: 1,
 decoration: InputDecoration(
              isDense: true,
              .
              .
              .)
like image 20
gopal sharma Avatar answered Mar 09 '26 21:03

gopal sharma



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!