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
+24-22Lines changed: 24 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,14 @@
1
1
# Form Builder Validators
2
2
3
-
Form Builder Validators set of validators for any `FormField` widget or widgets that extend the `FormField` class - *e.g.*, `TextFormField`, `DropdownFormField`, *et cetera*. It provides standard ready-made validation rules and a way to compose new validation rules combining multiple rules, including custom ones.
3
+
Form Builder Validators set of validators for any `FormField` widget or widgets that extend the `FormField` class - _e.g._, `TextFormField`, `DropdownFormField`, _et cetera_. It provides standard ready-made validation rules and a way to compose new validation rules combining multiple rules, including custom ones.
4
4
5
5
Also included is the `l10n` / `i18n` of error text messages to multiple languages.
-[Modify the default error message in a specific language](#modify-the-default-error-message-in-a-specific-language)
28
29
-[Support](#support)
29
-
-[Contribute](#contribute)
30
-
- [Add new supported language](#add-new-supported-language)
31
-
- [Add new validator](#add-new-validator)
32
-
-[Questions and answers](#questions-and-answers)
33
-
-[Donations](#donations)
30
+
-[Contribute](#contribute)
31
+
-[Add new supported language](#add-new-supported-language)
32
+
-[Add new validator](#add-new-validator)
33
+
-[Questions and answers](#questions-and-answers)
34
+
-[Donations](#donations)
34
35
-[Roadmap](#roadmap)
35
36
-[Ecosystem](#ecosystem)
36
37
-[Thanks to](#thanks-to)
@@ -139,6 +140,7 @@ Validators support default `errorText` messages in these languages:
139
140
- Italian (it)
140
141
- Japanese (ja)
141
142
- Korean (ko)
143
+
- Khmer (km)
142
144
- Lao (lo)
143
145
- Malay (ms)
144
146
- Mongolian (mn)
@@ -213,13 +215,13 @@ TextFormField(
213
215
validator: FormBuilderValidators.compose([
214
216
/// Makes this field required
215
217
FormBuilderValidators.required(),
216
-
218
+
217
219
/// Ensures the value entered is numeric - with a custom error message
218
220
FormBuilderValidators.numeric(errorText: 'La edad debe ser numérica.'),
219
-
221
+
220
222
/// Sets a maximum value of 70
221
223
FormBuilderValidators.max(70),
222
-
224
+
223
225
/// Include your own custom `FormFieldValidator` function, if you want
224
226
/// Ensures positive values only. We could also have used `FormBuilderValidators.min(0)` instead
225
227
(val) {
@@ -254,27 +256,27 @@ We welcome efforts to internationalize/localize the package by translating the d
254
256
255
257
1. Add ARB files
256
258
257
-
Create one ARB file inside the `lib/l10n` folder for each locale you need to add support. Name the files in the following way: `intl_<LOCALE_ISO_CODE>.arb`. For example: `intl_fr.arb` or `intl_fr_FR.arb`.
259
+
Create one ARB file inside the `lib/l10n` folder for each locale you need to add support. Name the files in the following way: `intl_<LOCALE_ISO_CODE>.arb`. For example: `intl_fr.arb` or `intl_fr_FR.arb`.
258
260
259
261
2. Translate the error messages
260
262
261
-
Copy and paste the contents of `intl_en.arb` into your newly created ARB file. Then translate the error messages by overwriting the default messages.
263
+
Copy and paste the contents of `intl_en.arb` into your newly created ARB file. Then translate the error messages by overwriting the default messages.
262
264
263
265
3. Generate localization code
264
266
265
-
To generate boilerplate code for localization, run the generate command inside the package directory where `pubspec.yaml` file is located:
267
+
To generate boilerplate code for localization, run the generate command inside the package directory where `pubspec.yaml` file is located:
266
268
267
-
`flutter gen-l10n`
269
+
`flutter gen-l10n`
268
270
269
-
The command will automatically create/update files inside the `lib/localization` directory, including your newly added locale support. The files in here are only necessary for local development and will not be committed to Github.
271
+
The command will automatically create/update files inside the `lib/localization` directory, including your newly added locale support. The files in here are only necessary for local development and will not be committed to Github.
270
272
271
273
4. Update README
272
274
273
-
Remember to update README, adding the new language (and language code) under [Supported languages section](#supported-languages) in alphabetic order, so that everyone knows your new language is now supported!
275
+
Remember to update README, adding the new language (and language code) under [Supported languages section](#supported-languages) in alphabetic order, so that everyone knows your new language is now supported!
274
276
275
277
5. Submit PR
276
278
277
-
Submit your PR and be of help to millions of developers all over the world!
279
+
Submit your PR and be of help to millions of developers all over the world!
0 commit comments