ScrollAnchor class
Pure scroll-offset math for preserving viewport position across layout changes. It computes target offsets; it never touches a ScrollController — the widget moves the scroll position to the result.
Every method returns null (or a null field) when no adjustment is needed.
The Scale and bulk methods also return null for a move of 0.5 px or less.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
offsetsForScaleChange(
{required double currentVerticalOffset, required double oldItemExtent, required double newItemExtent, required double oldTopPadding, required double newTopPadding, required double newContentHeight, required double viewportHeight, required double? currentHorizontalOffset, required double oldContentWidth, required double newContentWidth, required double hMinScrollExtent, required double hMaxScrollExtent}) → ({double? horizontal, double? vertical}) -
New vertical/horizontal offsets after a change of the row extent or the
top padding, such as a Scale change, preserving the node at the top of
the viewport. An offset inside the old top padding keeps its share of the
padding. The horizontal offset scales by the content-width ratio when
currentHorizontalOffsetis given. A field is null when that axis needs no move. -
verticalOffsetForBulkChange<
T> ({required List< FlatNode< oldList, required List<T> >FlatNode< newList, required double currentOffset, required double itemExtent, required double topPadding, required double newContentHeight, required double viewportHeight}) → double?T> > - New vertical offset after a bulk list change (e.g. expandAll/collapseAll), anchoring to the top node — or its nearest surviving ancestor if it was removed. Null when no adjustment is needed.
-
verticalOffsetForFlattenChange(
{required FlattenChange change, required double currentOffset, required double itemExtent, required double topPadding, required double newContentHeight, required double viewportHeight}) → double? - New vertical offset after an incremental single-node change, or null when the change happened at/below the viewport top (so nothing visible moves).