Skip to content

Commit a762227

Browse files
committed
Split
1 parent 98310fe commit a762227

9 files changed

+9
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 11.0.1
44

55
- Align between validator input types with other validators
6+
- Split up BaseValidator into TranslatedValidator so only that one needs to provide a translation
67

78
## 11.0.0
89

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ We welcome efforts to internationalize/localize the package by translating the d
382382
#### Add new validator
383383

384384
1. Add a new validator to one of the folders in the `src` folder.
385-
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+
2. Implement it using the `BaseValidator` or `TranslatedValidator` class. Override the `validateValue` method and let the base class handle the null check in the `validate` method. When using a translation also override `translatedErrorText`.
386386
3. Override the `translatedErrorText` property and return the correct translation from `FormBuilderLocalizations.current.`.
387387
4. Make sure to pass `errorText` and `checkNullOrEmpty` to the base class.
388388
5. Add static method to `form_builder_validators.dart` that uses the new validator.

lib/src/core/aggregate_validator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:flutter/widgets.dart';
33
import '../../form_builder_validators.dart';
44

55
/// {@template aggregate_validator_template}
6-
/// [AggregateValidator] extends [TranslatedValidator] to validate a value using a list of multiple validators.
6+
/// [AggregateValidator] extends [BaseValidator] to validate a value using a list of multiple validators.
77
///
88
/// ## Parameters:
99
///

lib/src/core/compose_validator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:flutter/widgets.dart';
33
import '../../form_builder_validators.dart';
44

55
/// {@template compose_validator_template}
6-
/// [ComposeValidator] extends [TranslatedValidator] to validate a value using a list of validators,
6+
/// [ComposeValidator] extends [BaseValidator] to validate a value using a list of validators,
77
/// returning the first validation error encountered.
88
///
99
/// ## Parameters:

lib/src/core/conditional_validator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:flutter/widgets.dart';
33
import '../../form_builder_validators.dart';
44

55
/// {@template conditional_validator_template}
6-
/// [ConditionalValidator] extends [TranslatedValidator] to conditionally validate a value based on a provided condition.
6+
/// [ConditionalValidator] extends [BaseValidator] to conditionally validate a value based on a provided condition.
77
///
88
/// ## Parameters:
99
///

lib/src/core/default_value_validator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:flutter/widgets.dart';
33
import '../../form_builder_validators.dart';
44

55
/// {@template default_value_validator_template}
6-
/// [DefaultValueValidator] extends [TranslatedValidator] to validate a value using a default value if the value is null.
6+
/// [DefaultValueValidator] extends [BaseValidator] to validate a value using a default value if the value is null.
77
///
88
/// ## Parameters:
99
///

lib/src/core/or_validator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:flutter/widgets.dart';
33
import '../../form_builder_validators.dart';
44

55
/// {@template or_validator_template}
6-
/// [OrValidator] extends [TranslatedValidator] to validate a value using multiple validators,
6+
/// [OrValidator] extends [BaseValidator] to validate a value using multiple validators,
77
/// returning null if at least one of the validators passes.
88
///
99
/// ## Parameters:

lib/src/core/skip_when_validator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:flutter/widgets.dart';
33
import '../../form_builder_validators.dart';
44

55
/// {@template skip_when_validator_template}
6-
/// [SkipWhenValidator] extends [TranslatedValidator] to conditionally skip validation based on a provided condition.
6+
/// [SkipWhenValidator] extends [BaseValidator] to conditionally skip validation based on a provided condition.
77
///
88
/// ## Parameters:
99
///

lib/src/core/transform_validator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:flutter/widgets.dart';
33
import '../../form_builder_validators.dart';
44

55
/// {@template transform_validator_template}
6-
/// [TransformValidator] extends [TranslatedValidator] to transform a value before applying a validator.
6+
/// [TransformValidator] extends [BaseValidator] to transform a value before applying a validator.
77
///
88
/// ## Parameters:
99
///

0 commit comments

Comments
 (0)