【发布时间】:2019-03-28 11:53:10
【问题描述】:
有没有办法在 TextFormField 中放置“忘记密码”标签?
在示例图片上放忘记密码?就在输入内部
new TextFormField(
decoration: InputDecoration(labelText: 'Password',
labelStyle: TextStyle(
color: Colors.black87,
fontSize: 17,
fontFamily: 'AvenirLight'
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.purple),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey,
width: 1.0)
),
),
style: TextStyle(
color: Colors.black87,
fontSize: 17,
fontFamily: 'AvenirLight'
),
controller: _passwordController,
obscureText: true,
),
【问题讨论】:
-
您必须专门使用
TextFormField吗?如果没有,您可以使用包含两个TextField和一些额外小部件的列来创建相同的用户体验。 -
嗯,基本上我可以使用你提到的方法重建 ui,但我很好奇是否可以使用 textformfield
-
使用 InputDecoration。您可以尝试使用 suffix、suffixIcon、prefix、prefixIcon 等 docs.flutter.io/flutter/material/InputDecoration-class.html