ToggleableStateMixin<S extends StatefulWidget> mixin
A mixin for StatefulWidgets that implement toggleable controls with toggle animations (e.g. Switches, CupertinoSwitches, Checkboxes, CupertinoCheckboxes, Radios, and CupertinoRadios).
The mixin implements the logic for toggling the control (e.g. when tapped) and provides a series of animation controllers to transition the control from one state to another. It does not have any opinion about the visual representation of the toggleable widget. The visuals are defined by a CustomPainter passed to the buildToggleable. State objects using this mixin should call that method from their build method.
- Superclass Constraints
Properties
- context → BuildContext
-
The location in the tree where this widget builds.
no setterinherited
- downPosition → Offset?
-
The most recent Offset at which a pointer touched the Toggleable.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInteractive → bool
-
Whether value of this control can be changed by user interaction.
no setter
- mounted → bool
-
Whether this State object is currently in a tree.
no setterinherited
-
onChanged
→ ValueChanged<
bool?> ? -
Called when the control changes value.
no setter
- position → CurvedAnimation
-
The visual value of the control.
no setter
- positionController → AnimationController
-
Used by subclasses to manipulate the visual value of the control.
no setter
- reaction → CurvedAnimation
-
The visual value of the radial reaction animation.
no setter
- reactionAnimationDuration → Duration?
-
The amount of time a circular ink response should take to expand to its
full size if a radial reaction is drawn using
ToggleablePainter.paintRadialReaction.
no setter
- reactionController → AnimationController
-
Used by subclasses to control the radial reaction animation.
no setter
- reactionFocusFade → CurvedAnimation
-
Controls the radial reaction's opacity animation for focus changes.
no setter
- reactionHoverFade → CurvedAnimation
-
Controls the radial reaction's opacity animation for hover changes.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
states
→ Set<
WidgetState> -
Describes the current
WidgetState
of the Toggleable.no setter - tristate → bool
-
If true, value can be true, false, or null, otherwise value must
be true or false.
no setter
- value → bool?
-
False if this control is "inactive" (not checked, off, or unselected).
no setter
- widget → S
-
The current configuration.
no setterinherited
Methods
-
activate(
) → void -
Called when this object is reinserted into the tree after having been
removed via deactivate.
inherited
-
animateToValue(
) → void - Runs the position animation to transition the Toggleable's appearance to match value.
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
inherited
-
buildToggleable(
{FocusNode? focusNode, ValueChanged< bool> ? onFocusChange, bool autofocus = false, WidgetStateProperty<MouseCursor> ? mouseCursor, required Size size, required CustomPainter painter}) → Widget -
Typically wraps a
painter
that draws the actual visuals of the Toggleable with logic to toggle it. -
createTicker(
TickerCallback onTick) → Ticker -
Creates a ticker with the given callback.
inherited
-
deactivate(
) → void -
Called when this object is removed from the tree.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
didChangeDependencies(
) → void -
Called when a dependency of this State object changes.
inherited
-
didUpdateWidget(
covariant S oldWidget) → void -
Called whenever the widget configuration changes.
inherited
-
dispose(
) → void -
Called when this object is removed from the tree permanently.
override
-
initState(
) → void -
Called when this object is inserted into the tree.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reassemble(
) → void -
Called whenever the application is reassembled during debugging, for
example during hot reload.
inherited
-
setState(
VoidCallback fn) → void -
Notify the framework that the internal state of this object has changed.
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
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited