SplitterController class Controller

A controller for a ResizableSplitter's position.

Holds the requested SplitterPosition (a fraction or a pixel pin) and exposes simple APIs to update or animate it; read effectiveFraction for the on-screen ratio after constraints are applied. A global pointer router prevents "stuck drags" when platform views steal pointer events. The router attaches only when a WidgetsBinding is available, so controllers created in pure Dart tests or before runApp stay functional - the enhanced drag cleanup simply activates once Flutter is initialized.

Inheritance
Mixed-in types

Constructors

SplitterController({SplitterPosition initialPosition = const SplitterPosition.fraction(0.5)})
Creates a splitter controller at initialPosition (default: centered).

Properties

collapsedPane SplitterPane?
Which pane, if any, is currently collapsed; null when neither is.
no setter
debugOwner Object?
Exposes the widget currently owning this controller in debug/test builds.
no setter
effectiveFraction double
The on-screen start fraction, in [0, 1]. Once laid out this is the resolved layout's fraction; before the first layout, while detached, or in the brief window after a request change before the next solve, it derives from the request - resolved against the last known extent, so a pixel pin still estimates sensibly (0 before any layout). For change notifications, listen to layoutListenable.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isAttached bool
Whether this controller is currently attached to a ResizableSplitter.
no setter
isCollapsed bool
Whether either pane is currently collapsed.
no setter
isDragging bool
A convenience getter for _isDragging as a boolean.
no setter
isDraggingListenable ValueListenable<bool>
Emits true while the user is dragging the handle.
no setter
layout SplitterLayout?
The resolved, on-screen layout the attached splitter last published, or null before the first layout (or while detached from any view).
no setter
layoutListenable ValueListenable<SplitterLayout?>
Notifies whenever the resolved layout changes. This is a separate observable from the request notifier (value); listen here to track the on-screen geometry rather than the intent.
no setter
position SplitterPosition
The requested position (a fraction or pixel pin); shorthand for value.position.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value SplitterState
The current value stored in this notifier.
getter/setter pairinherited-getteroverride-setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
animateTo(double target, {Duration duration = const Duration(milliseconds: 200), Curve curve = Curves.easeOutCubic}) Future<SplitterAnimationStatus>
Animates the split ratio to target, resolving with a SplitterAnimationStatus that reports how the run ended.
collapse(SplitterPane pane) → void
Collapses pane to its SplitterPaneConstraints.collapsedExtent, bypassing that pane's minimum. The position in value is left untouched, so expand restores the prior position. Collapsing the already-collapsed pane is a no-op; collapsing the other pane just moves the collapse across.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
dispose() → void
Discards any resources used by the object.
override
expand() → void
Expands a collapsed pane, restoring the position held before it collapsed (the untouched position). A no-op when neither pane is collapsed.
jumpTo(SplitterPosition position) → void
Requests position as a fresh intent: clears any collapse and supersedes a running animation. The on-screen result is still clamped by the solver.
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
reset([double to = 0.5]) → void
Resets the splitter to a fractional position, defaulting to center.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toggleCollapse(SplitterPane pane) → void
Collapses pane if it is not already collapsed, otherwise expands.
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
updateRatio(double newRatio, {double threshold = 0.002}) → void
Updates to a fractional position, with an optional threshold to prevent chatty updates. The threshold is compared against effectiveFraction.

Operators

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

Static Methods

resetGlobalRouter() → void
Resets the global pointer router. For testing only.