AgentLiveEdgeController class
Keeps a scrollable at its live edge while output grows, and lets the reader leave it.
The reader decides. Any scroll toward older content releases the edge at once, whatever produced it: a wheel or trackpad, a drag, the keyboard, a scrollbar or focus moving to an earlier message. A scroll that arrives at the end, or moves toward it and stops within threshold, follows again, and so does content that shrinks while the reader is within threshold of the end. While a hold is active (hold), the edge does not move the content; it catches up when the last hold ends.
Holding is pointer-driven: AgentLiveEdge holds while a pointer is down on the scrollable. Nothing here sees a text selection, so a host that wants a selection to hold the edge calls hold when the selection starts and unhold when it ends.
Wire a scrollable to it with AgentLiveEdge, which reports the scrollable's notifications and gives it AgentLiveEdgeScrollPhysics.
- Inheritance
-
- Object
- ChangeNotifier
- AgentLiveEdgeController
Constructors
- AgentLiveEdgeController({bool enabled = true, double threshold = 48})
- Creates a live edge that follows from the start.
Properties
- enabled ↔ bool
-
Whether the edge follows output at all.
getter/setter pair
- following → bool
-
Whether the reader is at the live edge rather than reading older output.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- holding → bool
-
Whether a hold keeps the content still.
no setter
- keepsEnd → bool
-
Whether growing output keeps the end in view right now.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showLatest → bool
-
Whether the reader is away from the end without being followed, so a
way back to the latest output should be offered.
no setter
- threshold ↔ double
-
How far from the end, in logical pixels, a scroll toward the end
follows again and the way back to the latest stays hidden.
getter/setter pair
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
attach(
ScrollController controller) → void - Connects the scroll controller of the scrollable this edge drives.
-
detach(
ScrollController controller) → void -
Disconnects
controllerif it is the attached one. -
dispose(
) → void -
Discards any resources used by the object.
override
-
handleScrollMetrics(
ScrollMetrics metrics) → void - Reads new extents from the attached scrollable.
-
handleScrollNotification(
ScrollNotification notification) → void - Reads a scroll notification from the attached scrollable.
-
hold(
) → void - Keeps the content still until a matching unhold.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
release(
) → void - Stops following, as if the reader had scrolled back.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resume(
) → void - Follows again; the end comes into view on the next frame.
-
scrollToEnd(
{bool animate = true, Duration duration = const Duration(milliseconds: 180), Curve curve = Curves.easeOut}) → Future< void> - Returns to the end and follows again.
-
toString(
) → String -
A string representation of this object.
inherited
-
unhold(
) → void - Ends one hold, and catches up with the end when it was the last.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited