ExpanderController class

A controller that manages the expanded state of an Expander widget.

ExpanderController provides programmatic control over an Expander's expansion state, allowing external toggling and direct setting from parent widgets or services. It uses a ValueNotifier for reactive updates, ensuring efficient state propagation without unnecessary rebuilds in the widget tree.

Key features:

  • Reactive state management via ValueNotifier, integrating seamlessly with Arcane's reactive patterns like Pylon for child notifications.
  • Simple API for toggle and set operations, with automatic listener notifications.
  • Supports initial state configuration for consistent UI initialization.

Usage in Arcane UI:

  • Integrate with Section to create collapsible content blocks in forms or lists.
  • Use in FillScreen or SliverScreen for dynamic panels, such as expandable settings groups or FAQ sections within BasicCard.
  • Pair with Gesture for custom interaction handling or ArcaneTheme for styled headers.

Performance notes:

  • Minimal overhead; notifies listeners only on state changes, avoiding full rebuilds.
  • Ideal for large UIs as it decouples state from widget rebuild cycles.

See also:

  • doc/component/expander.md for more detailed documentation
  • Expander, which uses this controller for external control

Constructors

ExpanderController({bool initiallyExpanded = false})
Creates an ExpanderController with an optional initial expanded state.

Properties

expanded ValueNotifier<bool>
A notifier that tracks the current expanded state.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setExpanded(bool value) → void
Sets the expansion state to the specified value.
toggle() → void
Toggles between expanded and collapsed states.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited