This commit is contained in:
2025-03-11 12:05:41 +02:00
parent b4b44cbae2
commit 85ab5ee4d3
2 changed files with 4 additions and 10 deletions

View File

@@ -92,7 +92,6 @@ class _AstromicFormFieldState<T> extends State<AstromicFormField<T>> {
// //
//SECTION - State Variables //SECTION - State Variables
//s1 --State //s1 --State
late bool _useFieldValidation;
late AstromicFieldState _currentState; late AstromicFieldState _currentState;
//s1 --State //s1 --State
// //
@@ -111,7 +110,6 @@ class _AstromicFormFieldState<T> extends State<AstromicFormField<T>> {
//SECTION - State Variables initializations & Listeners //SECTION - State Variables initializations & Listeners
//s1 --State //s1 --State
_currentState = AstromicFieldState.idle; _currentState = AstromicFieldState.idle;
_useFieldValidation = false;
//s1 --State //s1 --State
// //
//s1 --Controllers & Listeners //s1 --Controllers & Listeners
@@ -136,8 +134,8 @@ class _AstromicFormFieldState<T> extends State<AstromicFormField<T>> {
if (errorCodes.map(((String, String?) x) => x.$1).contains(toBeCaughtInternalErrorCode)) { if (errorCodes.map(((String, String?) x) => x.$1).contains(toBeCaughtInternalErrorCode)) {
if (mounted) { if (mounted) {
setState(() { setState(() {
_setFieldErrorState( _setFieldErrorState(widget.formID,
widget.formID, errorCodes.where(((String, String?) c) => c.$1 == toBeCaughtInternalErrorCode).first.$2 ?? widget.errorsCatcher![toBeCaughtInternalErrorCode] ?? 'Undefined Error Message'); errorCodes.where(((String, String?) c) => c.$1 == toBeCaughtInternalErrorCode).first.$2 ?? widget.errorsCatcher![toBeCaughtInternalErrorCode] ?? 'Undefined Error Message');
}); });
} }
} }
@@ -196,9 +194,6 @@ class _AstromicFormFieldState<T> extends State<AstromicFormField<T>> {
setState(() { setState(() {
if (widget.resetMessageOnChange ?? false) { if (widget.resetMessageOnChange ?? false) {
widget.formController.resetState(widget.formID); widget.formController.resetState(widget.formID);
setState(() {
_useFieldValidation = false;
});
} }
if (widget.onChanged != null) { if (widget.onChanged != null) {
widget.onChanged!(s, _currentState); widget.onChanged!(s, _currentState);
@@ -215,7 +210,6 @@ class _AstromicFormFieldState<T> extends State<AstromicFormField<T>> {
validator: (widget.validators != null && widget.validators!.isNotEmpty) validator: (widget.validators != null && widget.validators!.isNotEmpty)
? (bool enabled, bool focused, String? s) { ? (bool enabled, bool focused, String? s) {
widget.formController.resetState(widget.formID); widget.formController.resetState(widget.formID);
_useFieldValidation = true;
// //
List<FormControllerValidator> validators = <FormControllerValidator>[]; List<FormControllerValidator> validators = <FormControllerValidator>[];
// //
@@ -231,7 +225,7 @@ class _AstromicFormFieldState<T> extends State<AstromicFormField<T>> {
if (checks.containsValue(false)) { if (checks.containsValue(false)) {
// It has an Error! // It has an Error!
_setFieldErrorState(widget.formID, checks.entries.where((MapEntry<FormControllerValidator, bool> e) => e.value == false).toList().first.key.message); _setFieldErrorState(widget.formID, checks.entries.where((MapEntry<FormControllerValidator, bool> e) => e.value == false).toList().first.key.message);
return _useFieldValidation?'' : null; return '';
} else { } else {
// It has no Errors! // It has no Errors!
return null; return null;

View File

@@ -14,7 +14,7 @@ packages:
description: description:
path: "." path: "."
ref: master ref: master
resolved-ref: "3bdb21d401dc5bb9ce78e19bf8d1824383a6ee33" resolved-ref: "1ebdcb3125625126df0dee1e62d1cd48a50e2e00"
url: "https://git.micazi.dev/micazi/astromic_elements.git" url: "https://git.micazi.dev/micazi/astromic_elements.git"
source: git source: git
version: "0.1.3" version: "0.1.3"