NIB / DOCUMENTATION
Checkbox — NibComponents
Choose one item or express a mixed selection.
Open interactive viewKeep the checked value in your State
NibCheckbox is controlled: required value and onChanged describe the current and proposed states. A callback does not mutate value for you. The preview writes the emitted value back to settings. Null onChanged or disabled: true disables interaction.
Use null only for an indeterminate state
tristate defaults to false, which asserts that value is non-null. With tristate: true, taps cycle false → true → null → false. A mixed state is useful for a parent checkbox summarizing a partly selected list. Compute that state from the children; the checkbox does not discover them.
final bool? all = selected.isEmpty
? false
: selected.length == items.length ? true : null;
NibCheckbox(tristate: true, value: all, onChanged: (next) {
setState(() => selected = next == true ? items.toSet() : {});
});Make the row readable and tappable
label extends the tap target across the row. description supplies a second line. Without a label, give semanticLabel explicitly. size controls the visible box (default 20), while the widget keeps a minimum interaction area. activeColor overrides the checked and mixed fill; null uses NibTheme.primary.
Animate the mark, retain the meaning
animated: true adds a pop to the check or dash; the default false still changes value immediately. transition defaults to a 150 ms timing transition. Semantics include checked and, in tristate mode, mixed. A dash therefore carries meaning beyond color.
Avoid a checkbox that springs back
If the mark returns to its old position, update the value supplied by the parent. If null causes an assertion, enable tristate or map null to a boolean intentionally. Do not coerce a mixed parent to true before deciding whether the next action should select or clear its children.