From 0099841ef0c8d6d64d86f4b3ed1a06b8607dce51 Mon Sep 17 00:00:00 2001 From: vovaklh Date: Mon, 18 Aug 2025 21:19:03 +0200 Subject: [PATCH] Mark ReactiveCheckboxListTile control as touched on value change --- .../lib/src/reactive_checkbox_list_tile.dart | 81 ++++++++++--------- .../reactive_checkbox_list_tile/pubspec.yaml | 2 +- 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/packages/reactive_checkbox_list_tile/lib/src/reactive_checkbox_list_tile.dart b/packages/reactive_checkbox_list_tile/lib/src/reactive_checkbox_list_tile.dart index 8292a28f..2b42d37a 100644 --- a/packages/reactive_checkbox_list_tile/lib/src/reactive_checkbox_list_tile.dart +++ b/packages/reactive_checkbox_list_tile/lib/src/reactive_checkbox_list_tile.dart @@ -58,43 +58,46 @@ class ReactiveCheckboxListTile extends ReactiveFocusableFormField { ValueChanged? onFocusChange, String? checkboxSemanticLabel, }) : super( - builder: (field) { - return CheckboxListTile( - value: tristate ? field.value : field.value ?? false, - mouseCursor: mouseCursor, - fillColor: fillColor, - hoverColor: hoverColor, - overlayColor: overlayColor, - materialTapTargetSize: materialTapTargetSize, - splashRadius: splashRadius, - activeColor: activeColor, - checkColor: checkColor, - onFocusChange: onFocusChange, - isError: field.errorText != null, - title: title, - subtitle: subtitle, - isThreeLine: isThreeLine, - dense: dense, - secondary: secondary, - controlAffinity: controlAffinity, - autofocus: autofocus, - contentPadding: contentPadding, - tristate: tristate, - selectedTileColor: selectedTileColor, - tileColor: tileColor, - shape: shape, - selected: selected, - visualDensity: visualDensity, - focusNode: field.focusNode, - enableFeedback: enableFeedback, - checkboxShape: checkboxShape, - side: side, - enabled: field.control.enabled, - onChanged: field.control.enabled - ? field.didChange - : null, - checkboxSemanticLabel:checkboxSemanticLabel, - ); - }, - ); + builder: (field) { + return CheckboxListTile( + value: tristate ? field.value : field.value ?? false, + mouseCursor: mouseCursor, + fillColor: fillColor, + hoverColor: hoverColor, + overlayColor: overlayColor, + materialTapTargetSize: materialTapTargetSize, + splashRadius: splashRadius, + activeColor: activeColor, + checkColor: checkColor, + onFocusChange: onFocusChange, + isError: field.errorText != null, + title: title, + subtitle: subtitle, + isThreeLine: isThreeLine, + dense: dense, + secondary: secondary, + controlAffinity: controlAffinity, + autofocus: autofocus, + contentPadding: contentPadding, + tristate: tristate, + selectedTileColor: selectedTileColor, + tileColor: tileColor, + shape: shape, + selected: selected, + visualDensity: visualDensity, + focusNode: field.focusNode, + enableFeedback: enableFeedback, + checkboxShape: checkboxShape, + side: side, + enabled: field.control.enabled, + onChanged: (value) => field.control.enabled + ? () { + field.didChange(value); + field.control.markAsTouched(); + } + : null, + checkboxSemanticLabel: checkboxSemanticLabel, + ); + }, + ); } diff --git a/packages/reactive_checkbox_list_tile/pubspec.yaml b/packages/reactive_checkbox_list_tile/pubspec.yaml index 27b90ac6..d001448f 100644 --- a/packages/reactive_checkbox_list_tile/pubspec.yaml +++ b/packages/reactive_checkbox_list_tile/pubspec.yaml @@ -1,6 +1,6 @@ name: reactive_checkbox_list_tile description: Wrapper around CheckboxListTile to use with reactive_forms. -version: 1.0.1 +version: 1.0.2 repository: https://github.com/artflutter/reactive_forms_widgets/tree/master/packages/reactive_checkbox_list_tile issue_tracker: https://github.com/artflutter/reactive_forms_widgets/issues