代码之家  ›  专栏  ›  技术社区  ›  Farhana Naaz Ansari Jay Dwivedi

颤振:在TextFormField图标下方加下划线

  •  0
  • Farhana Naaz Ansari Jay Dwivedi  · 技术社区  · 6 年前

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

    enter image description here

    预期:

    enter image description here

    1 回复  |  直到 6 年前
        1
  •  4
  •   anmol.majhail    6 年前

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