Skip to content

Commit 48a0cdc

Browse files
authored
Merge pull request #204 from vovaklhdella/fix/checkbox-listtile-touched
Mark ReactiveCheckboxListTile control as touched on value change
2 parents 6ab7eda + 0099841 commit 48a0cdc

File tree

2 files changed

+43
-40
lines changed

2 files changed

+43
-40
lines changed

packages/reactive_checkbox_list_tile/lib/src/reactive_checkbox_list_tile.dart

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -58,43 +58,46 @@ class ReactiveCheckboxListTile<T> extends ReactiveFocusableFormField<T, bool> {
5858
ValueChanged<bool>? onFocusChange,
5959
String? checkboxSemanticLabel,
6060
}) : super(
61-
builder: (field) {
62-
return CheckboxListTile(
63-
value: tristate ? field.value : field.value ?? false,
64-
mouseCursor: mouseCursor,
65-
fillColor: fillColor,
66-
hoverColor: hoverColor,
67-
overlayColor: overlayColor,
68-
materialTapTargetSize: materialTapTargetSize,
69-
splashRadius: splashRadius,
70-
activeColor: activeColor,
71-
checkColor: checkColor,
72-
onFocusChange: onFocusChange,
73-
isError: field.errorText != null,
74-
title: title,
75-
subtitle: subtitle,
76-
isThreeLine: isThreeLine,
77-
dense: dense,
78-
secondary: secondary,
79-
controlAffinity: controlAffinity,
80-
autofocus: autofocus,
81-
contentPadding: contentPadding,
82-
tristate: tristate,
83-
selectedTileColor: selectedTileColor,
84-
tileColor: tileColor,
85-
shape: shape,
86-
selected: selected,
87-
visualDensity: visualDensity,
88-
focusNode: field.focusNode,
89-
enableFeedback: enableFeedback,
90-
checkboxShape: checkboxShape,
91-
side: side,
92-
enabled: field.control.enabled,
93-
onChanged: field.control.enabled
94-
? field.didChange
95-
: null,
96-
checkboxSemanticLabel:checkboxSemanticLabel,
97-
);
98-
},
99-
);
61+
builder: (field) {
62+
return CheckboxListTile(
63+
value: tristate ? field.value : field.value ?? false,
64+
mouseCursor: mouseCursor,
65+
fillColor: fillColor,
66+
hoverColor: hoverColor,
67+
overlayColor: overlayColor,
68+
materialTapTargetSize: materialTapTargetSize,
69+
splashRadius: splashRadius,
70+
activeColor: activeColor,
71+
checkColor: checkColor,
72+
onFocusChange: onFocusChange,
73+
isError: field.errorText != null,
74+
title: title,
75+
subtitle: subtitle,
76+
isThreeLine: isThreeLine,
77+
dense: dense,
78+
secondary: secondary,
79+
controlAffinity: controlAffinity,
80+
autofocus: autofocus,
81+
contentPadding: contentPadding,
82+
tristate: tristate,
83+
selectedTileColor: selectedTileColor,
84+
tileColor: tileColor,
85+
shape: shape,
86+
selected: selected,
87+
visualDensity: visualDensity,
88+
focusNode: field.focusNode,
89+
enableFeedback: enableFeedback,
90+
checkboxShape: checkboxShape,
91+
side: side,
92+
enabled: field.control.enabled,
93+
onChanged: (value) => field.control.enabled
94+
? () {
95+
field.didChange(value);
96+
field.control.markAsTouched();
97+
}
98+
: null,
99+
checkboxSemanticLabel: checkboxSemanticLabel,
100+
);
101+
},
102+
);
100103
}

packages/reactive_checkbox_list_tile/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: reactive_checkbox_list_tile
22
description: Wrapper around CheckboxListTile to use with reactive_forms.
3-
version: 1.0.1
3+
version: 1.0.2
44
repository: https://github.com/artflutter/reactive_forms_widgets/tree/master/packages/reactive_checkbox_list_tile
55
issue_tracker: https://github.com/artflutter/reactive_forms_widgets/issues
66

0 commit comments

Comments
 (0)