From 85ab5ee4d3cb01fd494d10ca4626b3bd0ebbb823 Mon Sep 17 00:00:00 2001 From: "Michael W. Aziz" Date: Tue, 11 Mar 2025 12:05:41 +0200 Subject: [PATCH] [0.1.2] --- lib/src/form/src/form_field.dart | 12 +++--------- pubspec.lock | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/src/form/src/form_field.dart b/lib/src/form/src/form_field.dart index 3911acb..5c82c46 100644 --- a/lib/src/form/src/form_field.dart +++ b/lib/src/form/src/form_field.dart @@ -92,7 +92,6 @@ class _AstromicFormFieldState extends State> { // //SECTION - State Variables //s1 --State - late bool _useFieldValidation; late AstromicFieldState _currentState; //s1 --State // @@ -111,7 +110,6 @@ class _AstromicFormFieldState extends State> { //SECTION - State Variables initializations & Listeners //s1 --State _currentState = AstromicFieldState.idle; - _useFieldValidation = false; //s1 --State // //s1 --Controllers & Listeners @@ -136,8 +134,8 @@ class _AstromicFormFieldState extends State> { if (errorCodes.map(((String, String?) x) => x.$1).contains(toBeCaughtInternalErrorCode)) { if (mounted) { setState(() { - _setFieldErrorState( - widget.formID, errorCodes.where(((String, String?) c) => c.$1 == toBeCaughtInternalErrorCode).first.$2 ?? widget.errorsCatcher![toBeCaughtInternalErrorCode] ?? 'Undefined Error Message'); + _setFieldErrorState(widget.formID, + errorCodes.where(((String, String?) c) => c.$1 == toBeCaughtInternalErrorCode).first.$2 ?? widget.errorsCatcher![toBeCaughtInternalErrorCode] ?? 'Undefined Error Message'); }); } } @@ -196,9 +194,6 @@ class _AstromicFormFieldState extends State> { setState(() { if (widget.resetMessageOnChange ?? false) { widget.formController.resetState(widget.formID); - setState(() { - _useFieldValidation = false; - }); } if (widget.onChanged != null) { widget.onChanged!(s, _currentState); @@ -215,7 +210,6 @@ class _AstromicFormFieldState extends State> { validator: (widget.validators != null && widget.validators!.isNotEmpty) ? (bool enabled, bool focused, String? s) { widget.formController.resetState(widget.formID); - _useFieldValidation = true; // List validators = []; // @@ -231,7 +225,7 @@ class _AstromicFormFieldState extends State> { if (checks.containsValue(false)) { // It has an Error! _setFieldErrorState(widget.formID, checks.entries.where((MapEntry e) => e.value == false).toList().first.key.message); - return _useFieldValidation?'' : null; + return ''; } else { // It has no Errors! return null; diff --git a/pubspec.lock b/pubspec.lock index 0bcab30..08f1978 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: description: path: "." ref: master - resolved-ref: "3bdb21d401dc5bb9ce78e19bf8d1824383a6ee33" + resolved-ref: "1ebdcb3125625126df0dee1e62d1cd48a50e2e00" url: "https://git.micazi.dev/micazi/astromic_elements.git" source: git version: "0.1.3"