SyncScrollController class
Sets up a collection of scroll controllers that mirror their movements to each other.
Controllers are added and returned via addAndGet. The initial offset
of the newly created controller is synced to the current offset.
Controllers must be dispose
d when no longer in use to prevent memory
leaks and performance degradation.
If controllers are disposed over the course of the lifetime of this object the corresponding scrollable's should be given unique keys. Without the keys, Flutter may reuse a controller after it has been disposed, which can cause the controller offsets to fall out of sync.
Constructors
- SyncScrollController.new({double initialScrollOffset = 0.0})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialScrollOffset → double
-
final
- offset → double
-
The current scroll offset of the group.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addAndGet(
String key) → ScrollController - Creates a new controller that is Sync to any existing ones.
-
addOffsetChangedListener(
VoidCallback onChanged) → void - Adds a callback that will be called when the value of offset changes.
-
animateTo(
double offset, {required Curve curve, required Duration duration}) → Future< void> -
Animates the scroll position of all Sync controllers to
offset
. -
dispose(
) → void -
jumpTo(
double value) → void -
Jumps the scroll position of all Sync controllers to
value
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeOffsetChangedListener(
VoidCallback listener) → void - Removes the specified offset changed listener.
-
resetScroll(
) → void - Resets the scroll position of all Sync controllers to 0.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited