PlannerController class

A public handle a host constructs and hands to a Planner to drive and observe its zoom from outside the widget (#76) — for example a custom zoom toolbar that lives in the host's own chrome rather than the planner's on-canvas buttons.

It is intentionally not a general-purpose controller: it only deals with zoom and exposes scroll read-back. Internally it attaches to the planner's private zoom/scroll Controller, which stays the single source of truth — no state is duplicated here, and clamping to minZoom/maxZoom stays in the Controller. Pass one to Planner(controller: ...) and typically set showZoomControls: false so the built-in buttons make way for your own.

As a ChangeNotifier it re-emits a notification on every view change (zoom and scroll), so a host toolbar can rebuild to, say, disable its + button once zoom reaches maxZoom. Notifications only fire while the controller is attached to a mounted planner; read zoom/minZoom/maxZoom/ dayScroll/timeScroll only while isAttached (the read getters throw otherwise, since there is no planner to read from).

Lifecycle (attach/detach) is handled by Planner; a host only constructs the controller, optionally listens to it, calls the zoom methods, and disposes it like any other ChangeNotifier.

Inheritance

Constructors

PlannerController()

Properties

dayScroll double
The day-axis (horizontal) scroll offset of the attached planner, in logical pixels (<= 0; 0 is the leftmost column). Read-only — this controller drives zoom, not scroll. Throws a StateError when not isAttached.
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 bound to a mounted Planner. Zoom methods are no-ops and the read getters throw while this is false, so a host that reads zoom/scroll outside a listener notification should guard on it (a freshly constructed controller, or one whose planner has been unmounted, is not attached).
no setter
maxZoom double
The maximum zoom the attached planner clamps to (its PlannerConfig.maxZoom). Throws a StateError when not isAttached.
no setter
minZoom double
The minimum zoom the attached planner clamps to (its PlannerConfig.minZoom). Throws a StateError when not isAttached.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeScroll double
The time-axis (vertical) scroll offset of the attached planner, in logical pixels (<= 0; 0 is the top of the grid). Read-only. Throws a StateError when not isAttached.
no setter
zoom double
The current zoom factor of the attached planner, in [minZoom, maxZoom]. Throws a StateError when not isAttached.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
attach(Controller inner) → void
Binds this controller to a planner's internal zoom/scroll Controller. Called by Planner from its initState/didUpdateWidgetnot part of the consumer API. Re-binding to the same inner is a no-op; binding to a different one detaches the previous first, so the listener is never doubled.
detach() → void
Unbinds from the current planner, removing the re-emit listener so nothing leaks past the planner's lifetime. Called by Planner from its dispose and on a controller swap — not part of the consumer API. Safe to call when already detached.
dispose() → void
Detaches before disposing so a still-attached controller can't fire notifyListeners after disposal (its planner normally detaches it first, but disposal order isn't guaranteed).
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
toString() String
A string representation of this object.
inherited
zoomIn([double factor = 1.1]) → void
Zooms in by factor (default 1.1), multiplying the current zoom and clamping to maxZoom in the Controller. A no-op when not isAttached.
zoomOut([double factor = 0.9]) → void
Zooms out by factor (default 0.9), multiplying the current zoom and clamping to minZoom in the Controller. A no-op when not isAttached.
zoomTo(double target) → void
Sets the zoom to an absolute target, clamped to [minZoom, maxZoom] by the Controller. A no-op when not isAttached.

Operators

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