Skip to content

Commit 0c1f8fe

Browse files
authored
Support tristate (#924)
Currently, the tristate property is not supported because null values are always discarded in the constructor, Added a check for tristate value, if false, enforce null-safety, otherwise use the value as-is.
1 parent 6cead1e commit 0c1f8fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/flutter_form_builder/lib/src/fields/form_builder_checkbox.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class FormBuilderCheckbox extends FormBuilderField<bool> {
117117
isThreeLine: false,
118118
title: title,
119119
subtitle: subtitle,
120-
value: state.value ?? false,
120+
value: tristate? state.value : (state.value ?? false),
121121
onChanged: state.enabled
122122
? (val) {
123123
state.requestFocus();

0 commit comments

Comments
 (0)