Skip to content

Commit 0f078c5

Browse files
Merge pull request #112 from martijn00/docs
Add changelog and changes in readme
2 parents 02eaed6 + 1a48286 commit 0f078c5

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
- Re-land generated l10n files
1010
- Add Bulgarian
1111

12+
### Breaking changes
13+
14+
- See Readme: <https://github.com/flutter-form-builder-ecosystem/form_builder_validators?tab=readme-ov-file#v10-to-v11>
15+
1216
### New validators
1317

1418
- Add creditCardExpirationDate

README.md

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,19 @@ Also included is the `l10n` / `i18n` of error text messages to multiple language
1919

2020
- [Features](#features)
2121
- [Validators](#validators)
22-
- [Supported languages](#supported-languages)
22+
- [Bool validators](#bool-validators)
23+
- [Collection validators](#collection-validators)
24+
- [Core validators](#core-validators)
25+
- [Datetime validators](#datetime-validators)
26+
- [File validators](#file-validators)
27+
- [Finance validators](#finance-validators)
28+
- [Identity validators](#identity-validators)
29+
- [Network validators](#network-validators)
30+
- [Numeric validators](#numeric-validators)
31+
- [String validators](#string-validators)
32+
- [Use-case validators](#use-case-validators)
33+
- [Extension method validators](#extension-method-validators)
34+
- [Supported languages](#supported-languages)
2335
- [Use](#use)
2436
- [Setup](#setup)
2537
- [Basic use](#basic-use)
@@ -28,6 +40,7 @@ Also included is the `l10n` / `i18n` of error text messages to multiple language
2840
- [Modify the default error message in a specific language](#modify-the-default-error-message-in-a-specific-language)
2941
- [Migrations](#migrations)
3042
- [v7 to v8](#v7-to-v8)
43+
- [v10 to 11](#v10-to-v11)
3144
- [Support](#support)
3245
- [Contribute](#contribute)
3346
- [Add new supported language](#add-new-supported-language)
@@ -172,7 +185,9 @@ URL, min, max, minLength, maxLength, minWordsCount, maxWordsCount, IP, credit ca
172185
- `FormBuilderValidators.uuid()` - requires the field's to be a valid uuid.
173186
- `FormBuilderValidators.vin()` - requires the field's to be a valid VIN number.
174187

175-
## Extension methods used for chaining validators
188+
### Extension method validators
189+
190+
Used for chaining and combining multiple validators.
176191

177192
- `FormBuilderValidator.and()` - Combines the current validator with another validator using logical AND.
178193
- `FormBuilderValidator.or()` - Combines the current validator with another validator using logical OR.
@@ -183,7 +198,7 @@ URL, min, max, minLength, maxLength, minWordsCount, maxWordsCount, IP, credit ca
183198
- `FormBuilderValidator.log()` - Logs the value during the validation process.
184199
- `FormBuilderValidator.withErrorMessage()` - Overrides the error message of the current validator.
185200

186-
### Supported languages
201+
## Supported languages
187202

188203
Validators support default `errorText` messages in these languages:
189204

@@ -314,6 +329,11 @@ see [override_form_builder_localizations_en](example/lib/override_form_builder_l
314329

315330
## Migrations
316331

332+
### v10 to v11
333+
334+
- All validators now first check for null or empty value and return an error if so. You can set `checkNullOrEmpty` to `false` if you want to avoid this behavior.
335+
- `dateString()` changed to `date()` for constancy in api naming. Simply change the name to fix the code.
336+
317337
### v7 to v8
318338

319339
Remove `context` as a parameter to validator functions. For example, `FormBuilderValidators.required(context)` becomes `FormBuilderValidators.required()` without `context` passed in.
@@ -360,14 +380,19 @@ We welcome efforts to internationalize/localize the package by translating the d
360380

361381
#### Add new validator
362382

363-
1. Add method to `validators.dart` with your Dart documentation
364-
2. Implement tests
365-
3. Add to [validators](#validators) with name and description
366-
4. Add message error translated on all languages (yes, all languages). To accomplish this need:
383+
1. Add a new validator to one of the folders in the `src` folder.
384+
2. Implement it using the `BaseValidator` class. Override the `validateValue` method and let the base class handle the null check in the `validate` method.
385+
3. Override the `translatedErrorText` property and return the correct translation from `FormBuilderLocalizations.current.`.
386+
4. Make sure to pass `errorText` and `checkNullOrEmpty` to the base class.
387+
5. Add static method to `form_builder_validators.dart` that uses the new validator.
388+
6. Implement tests
389+
7. Add to [validators](#validators) with name and description
390+
8. Add message error translated on all languages (yes, all languages). To accomplish this need:
367391
a. Add property to all `intl_*.arb` files, in alphabetic order.
368392
b. Translate message in all languages.
369393
c. Run `flutter gen-l10n` command
370-
5. Submit PR
394+
9. Run dart `dart fix --apply` and `dart format .`
395+
10. Submit PR
371396

372397
### Questions and answers
373398

0 commit comments

Comments
 (0)