WorkbenchPanelHost class

Composes a list of WorkbenchPanel descriptors into the View menu, tab strip, keyboard-shortcut map, and per-panel PanelLifecycle signaling — the four surfaces consumers used to maintain in parallel.

Lifecycle ownership. The host owns one PanelLifecycleController per panel, keyed by panel.id. isFocused evaluates as panelVisible && activeId == panel.id and re-publishes whenever either input changes. Controllers outlive panel-list reshape diffs that retain the same id; new ids get fresh controllers, dropped ids dispose theirs.

Active-tab persistence. The active panel id survives a panelVisible toggle — hide the panel, show it again, and the previously focused tab returns. The host clamps the persisted id to the current panel set on every rebuild, falling back to the first panel if the previous id has been removed.

Menu derivation. Panels with a non-null focusIntent produce View-menu entries; panels without one are omitted (the host has no intent to dispatch on selection). Consumers that need the menu entry must supply the intent and register a matching Action<Intent> in a surrounding Actions widget — the existing §spec:action-dispatch contract.

Builder pattern. The widget exposes its derived scope through builder rather than rendering chrome itself, so consumers stay in control of placement (menu position, shortcut wrapping, surrounding WorkbenchLayout parameters).

Inheritance

Constructors

WorkbenchPanelHost({Key? key, required List<WorkbenchPanel> panels, required bool panelVisible, required VoidCallback onTogglePanel, required WorkbenchPanelScopeBuilder builder, Object? initialActiveId, void onRegisterFocus(void focusById(Object id))?, ValueChanged<Object>? onActiveTabChanged})
const

Properties

builder WorkbenchPanelScopeBuilder
Builds the surrounding tree using the derived scope.
final
hashCode int
The hash code for this object.
no setterinherited
initialActiveId Object?
Optional initial active tab id. Defaults to the first panel. Ignored on subsequent rebuilds — the host owns active-tab state after the first frame.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onActiveTabChanged ValueChanged<Object>?
Notified whenever the active panel id changes — fires once after the first frame and then on every tab change. Useful for hosts that mirror the active panel for focus-or-hide selection semantics in the View menu.
final
onRegisterFocus → void Function(void focusById(Object id))?
Optional registration callback. The host invokes this once with a closure that focuses any panel by id; consumers store the closure and call it from Action<Intent> handlers (typical pattern: a focus-panel intent dispatches into this callback so menu and shortcut activation both route through the host's active-tab notifier).
final
onTogglePanel VoidCallback
Invoked when the tab strip's close button fires.
final
panels List<WorkbenchPanel>
Ordered panel descriptors. Must be non-empty.
final
panelVisible bool
Whether the bottom panel is currently visible. Drives the per-panel PanelLifecycle.isFocused value alongside the active-tab notifier.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<WorkbenchPanelHost>
Creates the mutable state for this widget at a given location in the tree.
override
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