Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup corect scrollOffsets when on beggining of the list #302

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/src/rendering/sliver_masonry_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,14 @@ class RenderSliverMasonryGrid extends RenderSliverMultiBoxAdaptor {
RenderBox? child = firstChild;

// If a new child is inserted and does not have a valid crossAxisIndex, we
// have to set it.
// have to set it. If we are on begginig of the list also set scrollOffset to 0.
if (child != null && indexOf(child) == 0) {
final firstChildParentData = _getParentData(child);
firstChildParentData.crossAxisIndex = 0;
final secondChild = childAfter(child);
if (secondChild != null && indexOf(secondChild) == 1) {
scrollOffsets.fillRange(0, crossAxisCount, 0);
}
}

// We populate our earliestScrollOffsets list.
Expand Down