效果图
new TextField(
onChanged: (str) {
username = str;
print(username);
},
decoration: new InputDecoration(
labelText: '用户名',
hintText: '请输入英文或数字',
),
maxLines: 1,
onSubmitted: (text) {
FocusScope.of(context).reparentIfNeeded(node);
},
),
new TextField(
onChanged: (text) {
pwd = text;
print(pwd);
},
obscureText: true,
maxLines: 1,
decoration:
new InputDecoration(hintText: '请输入长度大于6的密码', labelText: '密码'),
keyboardType: TextInputType.text,
onSubmitted: (text) {},
),