Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter: Underline below TextFormField icon

InputDecoration is not showing underline below icon in TextFormField

            TextFormField(
                          obscureText: true,
                          style: TextStyle(color: Colors.white),
                          keyboardType: TextInputType.text,
                          //validator: validatePassword,
                          decoration: InputDecoration(
                              icon: Icon(Icons.lock_outline,color: Colors.white,),
                              labelStyle: new TextStyle(color: Colors.white),
                              enabledBorder: UnderlineInputBorder(
                                  borderSide: new BorderSide(color: Colors.white)),
                              hintStyle: new TextStyle(
                                inherit: true,
                                fontSize: 18.0,
                                fontFamily: "WorkSansLight",
                                color: Colors.white,
                              ),
                              hintText: 'PASSWORD'),
                          onSaved: (String val) {

                          },
                        ),

getting this:

enter image description here

Expected:

enter image description here

like image 611
Farhana Naaz Ansari Avatar asked Mar 25 '26 16:03

Farhana Naaz Ansari


1 Answers

use - prefixIcon: instead of icon

TextFormField(
          obscureText: true,

          style: TextStyle(color: Colors.white),
          keyboardType: TextInputType.text,
          //validator: validatePassword,
          decoration: InputDecoration(
            prefixIcon: Icon(
              Icons.lock_outline,
              color: Colors.white,
            ),
              labelStyle: new TextStyle(color: Colors.white),
              enabledBorder: UnderlineInputBorder(
                  borderSide: new BorderSide(color: Colors.white)),
              hintStyle: new TextStyle(
                inherit: true,
                fontSize: 18.0,
                fontFamily: "WorkSansLight",
                color: Colors.white,
              ),
              hintText: 'PASSWORD'),
          onSaved: (String val) {},
        ),
like image 57
anmol.majhail Avatar answered Mar 27 '26 05:03

anmol.majhail



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!