我有2个表单域,我想验证第二个表单域以匹配第一个表单域的密码,我尝试了但没有成功..谢谢回答。
更新:我已经具有提交按钮及其功能,我想要第二个字段中的Validator来验证第一个字段文本以匹配第二个字段。
new TextFormField(
controller: _registerPassController,
decoration: new InputDecoration(labelText: 'Password'),
obscureText: true,
validator: (value) =>
value.isEmpty ? 'Password can\'t be empty' : null,
onSaved: (value) => _password = value,
),
],
),
new Stack(
alignment: const Alignment(1.0, 1.0),
children: <Widget>[
new TextFormField(
controller: _registerPassController2,
decoration: new InputDecoration(labelText: 'Retype Password'),
obscureText: true,
validator: (value) {
if (value.isEmpty) {
return 'Please enter some text';
}
},),
Run Code Online (Sandbox Code Playgroud)