TextFormField(
autofocus: true,
textInputAction: TextInputAction.next,
decoration: InputDecoration(
filled: true,
hintText: 'Your email address',
labelText: 'Email',
),
onChanged: (value) {
formData.email = value;
},
)
TextFormField 主要有以下属性:
autofocus 自动聚集
textInputAction 键盘操作按钮的类型,接收一个TextInputAction 类型的值。一般用InputDecoration修饰
decoration 修饰,主要通过文本,边框,图标,样式等进行修饰
onChanged 修改
maxLines: 5, 最大行数,比如为5
TextFormField(
decoration: InputDecoration(
hintText: 'Password',
),
obscureText: true,//密码可以加上这一项
),
---示例来自于官方的示例,里面的日期写的很好