ScrollAnchor class
Pure scroll-offset math for preserving viewport position across layout
changes. It computes target offsets; it never touches a ScrollController —
the widget applies the result (post-frame jumpTo, scrollbar re-sync).
Every method returns null (or a null field) when no adjustment is needed,
using a > 0.5px threshold to avoid churn.
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 Scale change, preserving the node at the top of the viewport. 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 minScrollExtent, required double maxScrollExtent}) → 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).