PostFrameScrollManager class

A controller that manages multiple ScrollControllers with unique keys.

This class provides a convenient way to create, access, and manage multiple scroll controllers in a single widget tree.

Example:

final scrollManager = PostFrameScrollManager();

// Create controllers
scrollManager.createController('list1');
scrollManager.createController('list2', initialScrollOffset: 100);

// Access controllers
final controller1 = scrollManager['list1'];

// Scroll to position
scrollManager.animateTo('list1', 500, duration: Duration(milliseconds: 300));

Constructors

PostFrameScrollManager()

Properties

controllers Iterable<ScrollController>
Returns all registered controllers.
no setter
hashCode int
The hash code for this object.
no setterinherited
keys Iterable<String>
Returns all registered controller keys.
no setter
length int
Returns the number of registered controllers.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addScrollListener(String key, VoidCallback listener) bool
Adds a scroll listener to the controller with the given key.
animateTo(String key, double offset, {required Duration duration, Curve curve = Curves.easeInOut}) Future<void>?
Animates the scroll position to offset for the controller with key.
createController(String key, {double initialScrollOffset = 0.0, bool keepScrollOffset = true}) ScrollController
Creates a new ScrollController with the given key.
dispose() → void
Disposes all controllers managed by this manager.
disposeController(String key) → void
Disposes a single controller with the given key.
getController(String key) ScrollController?
Gets a ScrollController by its key.
getMaxScrollExtent(String key) double?
Gets the max scroll extent of the controller with the given key.
getMinScrollExtent(String key) double?
Gets the min scroll extent of the controller with the given key.
getScrollOffset(String key) double?
Gets the current scroll offset of the controller with the given key.
hasController(String key) bool
Checks if a controller with the given key exists.
jumpTo(String key, double offset) bool
Jumps the scroll position to offset for the controller with key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeAllScrollListeners(String key) → void
Removes all scroll listeners from the controller with the given key.
removeScrollListener(String key, VoidCallback listener) bool
Removes a scroll listener from the controller with the given key.
scrollToBottom(String key, {Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) Future<void>?
Scrolls to the bottom of the scrollable for the controller with key.
scrollToTop(String key, {Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) Future<void>?
Scrolls to the top of the scrollable for the controller with key.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String key) ScrollController?
Gets a ScrollController by its key using bracket notation.