简体   繁体   中英

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:

在此处输入图片说明

Expected:

在此处输入图片说明

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) {},
        ),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM