gpt4 book ai didi

android - Flutter:TextFormField 图标下方的下划线

转载 作者:行者123 更新时间:2023-12-03 03:17:24 26 4
gpt4 key购买 nike

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

最佳答案

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

关于android - Flutter:TextFormField 图标下方的下划线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54516617/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com