Last active
October 30, 2021 19:41
-
-
Save umuieme/7c34aae6cb00eabb4063387fc9f04f80 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FormField<String>( | |
| autovalidateMode: AutovalidateMode.onUserInteraction, | |
| validator: (value) => | |
| (value?.isNotEmpty ?? false) ? null : "Cannot be null", | |
| onSaved: (value)=> customName = value, | |
| builder: (state) { | |
| return Column( | |
| crossAxisAlignment: CrossAxisAlignment.start, | |
| children: [ | |
| Row( | |
| children: [ | |
| Expanded( | |
| child: TextFormField( | |
| decoration: const InputDecoration( | |
| hintText: "Custom Name"), | |
| onChanged: (value) => state.didChange(value), | |
| ), | |
| ), | |
| if (state.isValid) const Icon(Icons.check), | |
| if (state.hasError) | |
| const Icon( | |
| Icons.close, | |
| color: Colors.red, | |
| ), | |
| ], | |
| ), | |
| if (state.hasError) | |
| Text( | |
| state.errorText ?? "", | |
| style: const TextStyle(color: Colors.red), | |
| ) | |
| ], | |
| ); | |
| }, | |
| ), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment