FossCheckbox class Inputs

See the checkbox documentation ↗ or try it live in the playground ↗.
A checkbox: an independent on / off toggle that can also show an indeterminate state.
value is tristate: true checked, false unchecked, null indeterminate
(the minus glyph). A tap reports the new definite state through onChanged:
unchecked and indeterminate go to true, checked goes to false. The
checkbox never produces null itself; set value to null to drive the
indeterminate state. onChanged: null (or enabled: false) disables it.
Renders a square box with an optional label and description. A non-null
errorText marks it invalid and shows a caption below. Colors, type, and
spacing come from context.fossTheme; pass a FossCheckboxStyle to style
for a one-off.
For a multi-select set of options, see FossCheckboxGroup.
Customize globally by passing your own FossThemeData, or per instance
through the widget's style object. There are no per-instance token props:
to change color, radius, or spacing, change the theme.
See also FossCheckboxGroup for a multi-select set, and FossRadio or FossSwitch for related toggles.
FossCheckbox(
value: accepted,
label: 'Accept terms and conditions',
onChanged: (checked) => setState(() => accepted = checked),
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- FossCheckbox
Constructors
-
FossCheckbox({bool? value = false, ValueChanged<
bool> ? onChanged, String? label, String? description, String? errorText, bool enabled = true, FossCheckboxStyle? style, Key? key}) -
const
Properties
- description → String?
-
Optional secondary line below the label.
final
- enabled → bool
-
Whether the checkbox accepts input. Disabled when false or when
onChanged is null.
final
- errorText → String?
-
Error caption below the control. A non-null value marks it invalid.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
Optional title beside the box.
final
-
onChanged
→ ValueChanged<
bool> ? -
Called with the new definite state on a tap. Null disables the checkbox.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → FossCheckboxStyle?
-
Per-instance overrides layered on the theme-resolved style.
final
- value → bool?
-
The checked state:
true,false, ornullfor indeterminate.final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited