FluentCheckbox class
A Fluent 2 checkbox, with the mixed (indeterminate) state.
FluentCheckbox(
checked: agreed,
label: const Text('I agree'),
onChanged: (value) => setState(() => agreed = value),
)
checked is tri-state: true, false, or null for mixed. Mixed is a
value a parent sets to report partially-selected children; the control never
reports it back, so tapping a mixed checkbox reports true, matching
upstream, where the browser's own indeterminate input resolves the same
way.
Pass onChanged: null to disable it — disabled is a real state here, not a
visual treatment: the checkbox stops reporting hover and press, refuses
focus, never invokes the callback, and swaps to the disabled token ramp
wholesale rather than fading the enabled one.
Nothing animates. See buildFluentCheckbox.
Customisation follows the usual three rungs. style is merged last and wins; FluentCheckboxTheme restyles a subtree; and for anything further, resolveFluentCheckboxState, resolveFluentCheckboxStyle and buildFluentCheckbox are public so any one of them can be replaced without forking this widget.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- FluentCheckbox
Constructors
-
FluentCheckbox({Key? key, bool? checked = false, ValueChanged<
bool?> ? onChanged, Widget? label, FluentCheckboxSize size = FluentCheckboxSize.medium, FluentCheckboxShape shape = FluentCheckboxShape.square, FluentCheckboxLabelPosition labelPosition = FluentCheckboxLabelPosition.after, FluentCheckboxStyle? style, FocusNode? focusNode, bool autofocus = false, String? semanticLabel}) -
Creates a checkbox with an optional
label.const
Properties
- autofocus → bool
-
Whether to take focus on mount.
final
- checked → bool?
-
The tri-state value. Null is the mixed state.
final
- focusNode → FocusNode?
-
Focus node to use. One is created internally when omitted.
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 → Widget?
-
The label. Null renders the indicator alone, in which case
semanticLabel carries the meaning.
final
- labelPosition → FluentCheckboxLabelPosition
-
Which side the label sits on.
final
-
onChanged
→ ValueChanged<
bool?> ? -
Invoked with the next value on tap and on Space or Enter. Null disables
the checkbox.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
Announced by assistive technology alongside the checked state.
final
- shape → FluentCheckboxShape
-
Corner treatment of the indicator box.
final
- size → FluentCheckboxSize
-
Indicator box and glyph size.
final
- style → FluentCheckboxStyle?
-
Overrides layered over the theme defaults. Merged last, so it wins.
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