flutter中获取TextField的值需要通过TextEditingController,示例代码如下:
TextEditingController emailController = new TextEditingController();//声明controller
....
TextField(
controller: emailController,//指定controller
obscureText: true,
textAlign: TextAlign.left,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '输入电子邮箱',
hintStyle: TextStyle(color: Colors.grey),
),
)
然后通过emailController.text就可以获取到对应的TextField的值