Skip to content

Commit

Permalink
documentation in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
grappetite-ali committed Sep 4, 2019
1 parent 595d879 commit 440f6c6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ TextFormField(

All validator functions have have return type of `FormFieldValidator<String>` which is required type for `validator` field in `TextFormField`.

___

### Required

Expand All @@ -50,9 +51,9 @@ All validator functions have have return type of `FormFieldValidator<String>` wh
```dart
TextFormField(
decoration: InputDecoration(
labelText: 'Email',
labelText: 'Name',
),
validator: Validators.email('Invalid email address'),
validator: Validators.required('Name is required'),
),
```
#### Documentation
Expand All @@ -61,15 +62,21 @@ TextFormField(
| ------------- | ------------- |
| errorMessage | `String` value is passed to to this parameter to show error in case of validation failure|

___

### Minimum
`Validators.min(double min, String errorMessage)` is used to make sure that TextFormField's value is greater than or equal to the provided number. Number can be integer or double.

#### Documentation
`Validators.min` takes two parameters.

| Params | Description |
| ------------- | ------------- |
| min | `double` value is passed to this param. Validator will return error if TextFormField value is less than `min`|
| min | `double` value is passed to this param.

Validator will return error if TextFormField value is less than `min`|
| errorMessage | `String` value is passed to to this parameter to show error in case of validation failure|

**_Note:_** _If `TextFormField`'s value is empty, then this validator won't return any error because it considers `TextFormField` as optional. Use this validation with combination of [Required](#required) validator if specified `TextFormField` is compulsory. Check [Compose](#compose) validator to find out how to combine two validators_
**_Note:_** _If `TextFormField`'s value is empty, then this validator won't return any error because it considers `TextFormField` as optional. Use this validation with combination of [Required](#required) validator if specified `TextFormField` is compulsory. Check [Compose](#compose) validator to find out how to combine two validators_

___

0 comments on commit 440f6c6

Please sign in to comment.