0 purchases
validation localizations
Validation localizations delivers a prepeard localizations labels for most used validations messages.
We recommend using Flutter Validation for the best experience.
Getting Started #
Add to your dependencies:
dependencies:
validation_localization: ^1.0.0
copied to clipboard
Add delegates in your MaterialApp widget:
MaterialApp(
// ...
localizationsDelegates: [
AttributeLocalizations.delegate,
ValidationLocalizations.delegate,
],
supportedLocales: [
const Locale('en'),
const Locale('ar'),
/// add other locales for now (en, ar)
],
// ...
)
copied to clipboard
Use it:
/// ...
TextFormField(
validator: (value) {
if (value.isEmpty) {
return ValidationLocalizations.of(context).required(
AttributeLocalizations.of(context).password
);
}
if (value.length < 6) {
// Password is too short (minimum is 6 characters)}
return ValidationLocalizations.of(context).minLength(
AttributeLocalizations.of(context).password,
6, // count
);
}
return null;
}
)
/// ..
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.