verticalOffsetForFlattenChange static method
New vertical offset after an incremental single-node change, or null when the change happened at/below the viewport top (so nothing visible moves).
Implementation
static double? verticalOffsetForFlattenChange({
required FlattenChange change,
required double currentOffset,
required double itemExtent,
required double topPadding,
required double minScrollExtent,
required double maxScrollExtent,
}) {
final changePixel = topPadding + (change.index + 1) * itemExtent;
if (changePixel <= currentOffset) {
final delta = change.deltaItems * itemExtent;
return (currentOffset + delta).clamp(minScrollExtent, maxScrollExtent);
}
return null;
}