WorkbenchViewDescriptor class
Typed descriptor for one view in a WorkbenchViewContainer (§spec:view-stack). The host supplies an ordered list of these — never a free-form sidebar-body widget — and the container renders the stack.
A descriptor carries no collapsible flag: collapsibility is derived by
the container from the number of views (§spec:view-stack), not chosen per
view. The descriptor owns the body and the view's expansion state
(controlled or uncontrolled, §spec:section-disclosure); the container owns
the collapsible decision.
Constructors
-
WorkbenchViewDescriptor({required String id, required String title, String? infoTooltip, bool visible = true, bool canHide = true, ValueChanged<
bool> ? onVisibleChanged, List<Widget> actions = const [], bool actionsAlwaysVisible = false, bool initiallyExpanded = true, bool? expanded, ValueChanged<bool> ? onExpandedChanged, double? maximumBodySize, required Widget bodyBuilder(BuildContext)}) -
const
Properties
-
actions
→ List<
Widget> -
Host-supplied header widgets, placed and revealed by the pane
(§spec:section-header-actions).
final
- actionsAlwaysVisible → bool
-
Pin actions on regardless of hover or focus, while expanded.
final
- bodyBuilder → Widget Function(BuildContext)
-
Builds the view body. The host owns body content (§spec:scope); the
container owns the header and the stacking chrome.
final
- canHide → bool
-
Whether the user may hide this view from the Views overflow (VS Code's
canToggleVisibility, §spec:view-container-title). A non-hideable view shows a disabled Views-submenu checkbox and cannot be hidden.final - expanded → bool?
-
Controlled expansion. When non-null the host drives the value; tapping
the header reports the requested next value via onExpandedChanged and
does not self-toggle until the host pushes a new descriptor list.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Stable identity. The container keys each pane by this id so expansion
state survives reorders within the same descriptor list.
final
- infoTooltip → String?
-
Optional metadata icon tooltip in the header (the shell's analog of VS
Code's dimmed
.description).final - initiallyExpanded → bool
-
Seed for uncontrolled expansion. Ignored when expanded is supplied.
final
- maximumBodySize → double?
-
Optional cap on this pane's apportioned body height, in pixels
(§spec:view-pane-max-body). Null is unbounded — the pane fills its share
as before. Mirrors VS Code's
maximumBodySize: the clamp is canon (min(max(value, minBody), maxBody)), so a value below WorkbenchLayoutConstants.viewPaneMinBodyHeight wins over the floor and the pane renders below it (hug-to-content).final -
Label for this view in the container title's Views overflow, when it must
differ from the pane-header title. VS Code's file explorer shows the
workspace folder name in its pane header but "Folders" in the Views menu —
its
IViewDescriptor.name(menu) is distinct from its runtime-overridden title (header). Null (the default) reuses title for both.final -
onExpandedChanged
→ ValueChanged<
bool> ? -
Fired when header activation requests a new expanded state.
final
-
onVisibleChanged
→ ValueChanged<
bool> ? -
Fired when a Views-overflow toggle requests a new visible state. Its
presence makes visible host-controlled (see visible).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- title → String
-
final
- visible → bool
-
Seed for this view's visibility in the container title's Views overflow
(§spec:view-container-title). True (the default) shows the pane in the
stack; false starts it hidden. Visibility is a third per-view state
distinct from order and expansion: a hidden view leaves the stack entirely
while keeping its
orderslot, so re-showing restores its position.final
Methods
-
copyWith(
{String? id, String? title, String? infoTooltip, bool? visible, bool? canHide, ValueChanged< bool> ? onVisibleChanged, List<Widget> ? actions, bool? actionsAlwaysVisible, bool? initiallyExpanded, bool? expanded, ValueChanged<bool> ? onExpandedChanged, double? maximumBodySize, Widget bodyBuilder(BuildContext)?}) → WorkbenchViewDescriptor -
Returns a copy with the given fields replaced. Omitted fields keep their
current value (the standard
copyWithidiom, so a nullable field cannot be reset to null through it) — lets a host seed a subset without hand-copying every field and silently dropping any the shell adds later. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited