From 3a9299e016cd3140d6eba6994b23fabba85a78d9 Mon Sep 17 00:00:00 2001 From: Vasiliy Ditsyak Date: Tue, 5 Nov 2024 16:10:53 +0100 Subject: [PATCH] reactive_input_decorator 0.0.7 --- .../reactive_input_decorator/CHANGELOG.md | 4 +++ .../lib/src/reactive_input_decorator.dart | 34 +++++++++---------- .../reactive_input_decorator/pubspec.yaml | 2 +- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/packages/reactive_input_decorator/CHANGELOG.md b/packages/reactive_input_decorator/CHANGELOG.md index c4678d4..c7e0f9d 100644 --- a/packages/reactive_input_decorator/CHANGELOG.md +++ b/packages/reactive_input_decorator/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.7 + +* fix: properly apply default text style for error builder + ## 0.0.6 * `errorBuilder` diff --git a/packages/reactive_input_decorator/lib/src/reactive_input_decorator.dart b/packages/reactive_input_decorator/lib/src/reactive_input_decorator.dart index 62238ed..6f6aac2 100644 --- a/packages/reactive_input_decorator/lib/src/reactive_input_decorator.dart +++ b/packages/reactive_input_decorator/lib/src/reactive_input_decorator.dart @@ -117,30 +117,30 @@ class ReactiveInputDecorator extends ReactiveFormField { return IgnorePointer( ignoring: !field.control.enabled, child: Listener( - onPointerDown: markAsTouched == MarkAsTouched.pointerDown ? (_) => field.control.markAsTouched() : null, - onPointerUp: markAsTouched == MarkAsTouched.pointerUp ? (_) => field.control.markAsTouched() : null, + onPointerDown: markAsTouched == MarkAsTouched.pointerDown + ? (_) => field.control.markAsTouched() + : null, + onPointerUp: markAsTouched == MarkAsTouched.pointerUp + ? (_) => field.control.markAsTouched() + : null, child: InputDecorator( decoration: effectiveDecoration.copyWith( - errorText: errorBuilder == null ? field.errorText : null, - enabled: field.control.enabled, + errorText: errorBuilder == null ? field.errorText : null, + enabled: field.control.enabled, error: errorBuilder != null && errorText != null - ? DefaultTextStyle( - style: Theme.of(field.context) - .textTheme - .bodySmall - ?.copyWith( - color: - Theme.of(field.context).colorScheme.error, - ) ?? - const TextStyle(), - child: errorBuilder.call(field.context, errorText), - ) - : null - ), + ? DefaultTextStyle.merge( + style: effectiveDecoration.errorStyle, + child: errorBuilder.call( + field.context, + errorText, + ), + ) + : null), expands: expands, baseStyle: baseStyle, textAlign: textAlign, textAlignVertical: textAlignVertical, + isFocused: field.focusNode?.hasFocus ?? false, child: child, ), ), diff --git a/packages/reactive_input_decorator/pubspec.yaml b/packages/reactive_input_decorator/pubspec.yaml index 8a083f9..b53e9d3 100644 --- a/packages/reactive_input_decorator/pubspec.yaml +++ b/packages/reactive_input_decorator/pubspec.yaml @@ -1,6 +1,6 @@ name: reactive_input_decorator description: Wrapper around input_decorator to use with reactive_forms. -version: 0.0.6 +version: 0.0.7 repository: https://github.com/artflutter/reactive_forms_widgets/tree/master/packages/reactive_input_decorator issue_tracker: https://github.com/artflutter/reactive_forms_widgets/issues