AgentDisclosureController class
The open state of one collapsible Agent surface.
The state is either uncontrolled, stored here from defaultExpanded, or
controlled by the host through updateExpanded. Releasing control keeps
the last controlled value. Every request, from the reader (toggle) or
from the work's lifecycle (updatePhase under policy), is reported to
onExpandedChanged, even when it does not change the stored value: a
controlled host decides for itself.
A request from the reader reaches onExpandedChanged at once. A request
from the lifecycle is deferred until after the frame during build or
layout, so the host can call setState in it. Otherwise it arrives at once.
Listeners hear about changes to expanded.
- Inheritance
-
- Object
- ChangeNotifier
- AgentDisclosureController
Constructors
-
AgentDisclosureController({AgentWorkPhase phase = AgentWorkPhase.settled, bool? expanded, bool defaultExpanded = true, AgentDisclosurePolicy policy = const AgentDisclosurePolicy(), ValueChanged<
bool> ? onExpandedChanged}) -
Creates a disclosure in
phase.
Properties
- expanded → bool
-
Whether the surface is open.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isControlled → bool
-
Whether the host controls expanded.
no setter
-
onExpandedChanged
↔ ValueChanged<
bool> ? -
Receives every open or close request.
getter/setter pair
- phase → AgentWorkPhase
-
Where the work behind the surface is.
no setter
- policy ↔ AgentDisclosurePolicy
-
When the work opens and closes the surface.
getter/setter pair
- readerToggled → bool
-
Whether the reader toggled the surface during the current run.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toggle(
bool expanded) → void -
Records the reader's request to open (
expandedtrue) or close. -
toString(
) → String -
A string representation of this object.
inherited
-
updateExpanded(
bool? expanded) → void - Adopts the host's controlled value; null hands control back and keeps the last controlled value.
-
updatePhase(
AgentWorkPhase next) → void -
Moves the work to
nextand applies the policy's request, if any.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited