You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,7 @@ Also included is the `l10n` / `i18n` of error text messages to multiple language
28
28
-[Modify the default error message in a specific language](#modify-the-default-error-message-in-a-specific-language)
29
29
-[Migrations](#migrations)
30
30
-[v7 to v8](#v7-to-v8)
31
+
-[v10 to 11](#v10-to-v11)
31
32
-[Support](#support)
32
33
-[Contribute](#contribute)
33
34
-[Add new supported language](#add-new-supported-language)
@@ -314,6 +315,11 @@ see [override_form_builder_localizations_en](example/lib/override_form_builder_l
314
315
315
316
## Migrations
316
317
318
+
### v10 to v11
319
+
320
+
- 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.
321
+
-`dateString()` changed to `date()` for constancy in api naming. Simply change the name to fix the code.
322
+
317
323
### v7 to v8
318
324
319
325
Remove `context` as a parameter to validator functions. For example, `FormBuilderValidators.required(context)` becomes `FormBuilderValidators.required()` without `context` passed in.
@@ -360,14 +366,19 @@ We welcome efforts to internationalize/localize the package by translating the d
360
366
361
367
#### Add new validator
362
368
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:
369
+
1. Add a new validator to one of the folders in the `src` folder.
370
+
2. Implement it using the `BaseValidator` class. Override the `validateValue` method and let the base class handle the null check in the `validate` method.
371
+
3. Override the `translatedErrorText` property and return the correct translation from `FormBuilderLocalizations.current.`.
372
+
4. Make sure to pass `errorText` and `checkNullOrEmpty` to the base class.
373
+
5. Add static method to `form_builder_validators.dart` that uses the new validator.
374
+
6. Implement tests
375
+
7. Add to [validators](#validators) with name and description
376
+
8. Add message error translated on all languages (yes, all languages). To accomplish this need:
367
377
a. Add property to all `intl_*.arb` files, in alphabetic order.
368
378
b. Translate message in all languages.
369
379
c. Run `flutter gen-l10n` command
370
-
5. Submit PR
380
+
9. Run dart `dart fix --apply` and `dart format .`
0 commit comments