简体   繁体   English

颤振:在TextFormField图标下划线

[英]Flutter: Underline below TextFormField icon

InputDecoration is not showing underline below icon in TextFormField InputDecoration未在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 使用prefixIcon:代替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) {},
        ),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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