Skip to content

Commit

Permalink
Move default inputKey value into default constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
petrnymsa committed Nov 1, 2023
1 parent 578f613 commit b364c73
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions glade_forms/lib/src/core/glade_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class GladeInput<T> extends ChangeNotifier {
required this.validatorInstance,
required bool isPure,
required this.valueComparator,
required this.inputKey,
required String? inputKey,
required this.translateError,
required this.stringTovalueConverter,
required InputDependenciesFactory? dependenciesFactory,
Expand All @@ -157,6 +157,7 @@ class GladeInput<T> extends ChangeNotifier {
_value = value,
_initialValue = initialValue,
dependenciesFactory = dependenciesFactory ?? (() => []),
inputKey = inputKey ?? '__${T.runtimeType}__${Random().nextInt(100000000)}',
valueTransform = valueTransform ?? _defaultTransform,
_textEditingController = textEditingController ??
(createTextController
Expand Down Expand Up @@ -201,7 +202,7 @@ class GladeInput<T> extends ChangeNotifier {
initialValue: initialValue,
translateError: translateError,
valueComparator: valueComparator,
inputKey: inputKey ?? '__${T.runtimeType}__${Random().nextInt(100)}',
inputKey: inputKey,
stringTovalueConverter: valueConverter,
dependenciesFactory: dependencies,
onChange: onChange,
Expand All @@ -219,7 +220,7 @@ class GladeInput<T> extends ChangeNotifier {
/// In case of need of any validation use [GladeInput.create] directly.
factory GladeInput.optional({
required T value,
required String inputKey,
String? inputKey,
T? initialValue,
bool pure = true,
ErrorTranslator<T>? translateError,
Expand Down Expand Up @@ -252,7 +253,7 @@ class GladeInput<T> extends ChangeNotifier {
/// In case of need of any aditional validation use [GladeInput.create] directly.
factory GladeInput.required({
required T value,
required String inputKey,
String? inputKey,
T? initialValue,
bool pure = true,
ErrorTranslator<T>? translateError,
Expand Down Expand Up @@ -286,7 +287,7 @@ class GladeInput<T> extends ChangeNotifier {

static GladeInput<int> intInput({
required int value,
required String inputKey,
String? inputKey,
ValidatorFactory<int>? validator,
int? initialValue,
bool pure = true,
Expand Down Expand Up @@ -316,7 +317,7 @@ class GladeInput<T> extends ChangeNotifier {

static GladeInput<bool> boolInput({
required bool value,
required String inputKey,
String? inputKey,
ValidatorFactory<bool>? validator,
bool? initialValue,
bool pure = true,
Expand Down Expand Up @@ -345,7 +346,7 @@ class GladeInput<T> extends ChangeNotifier {
);

static GladeInput<String?> stringInput({
required String inputKey,
String? inputKey,
String? value,
StringValidatorFactory? validator,
String? initialValue,
Expand Down

0 comments on commit b364c73

Please sign in to comment.