File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -172,29 +172,30 @@ FormBuilder(
172
172
child: Column(
173
173
children: [
174
174
FormBuilderTextField(
175
- key: _emailFieldKey
175
+ key: _emailFieldKey,
176
176
name: 'email',
177
- decoration: InputDecoration(labelText: 'Email'),
177
+ decoration: const InputDecoration(labelText: 'Email'),
178
178
validator: FormBuilderValidators.compose([
179
179
FormBuilderValidators.required(),
180
180
FormBuilderValidators.email(),
181
181
]),
182
182
),
183
- RaisedButton (
184
- child: Text('Submit'),
183
+ ElevatedButton (
184
+ child: const Text('Submit'),
185
185
onPressed: () async {
186
186
if(await checkIfEmailExists()){
187
187
// Either invalidate using Form Key
188
- _formKey.currentState?.invalidateField(name: 'email', errorText: 'Email already taken.');
188
+ _formKey.currentState?.invalidateField(
189
+ name: 'email', errorText: 'Email already taken.');
189
190
// OR invalidate using Field Key
190
- _emailFieldKey.currentState?.invalidate('Email already taken');
191
+ _emailFieldKey.currentState
192
+ ?.invalidate('Email already taken');
191
193
}
192
194
},
193
195
),
194
196
],
195
197
),
196
198
),
197
-
198
199
```
199
200
200
201
##### Option 2 - Using InputDecoration.errorText
You can’t perform that action at this time.
0 commit comments