From 4b04565451723d25ad8b2bc25ff695bd854ec0b2 Mon Sep 17 00:00:00 2001 From: yuanl Date: Thu, 27 Oct 2022 15:58:05 +0800 Subject: [PATCH] fix #issue265 temporay --- lib/src/rendering/sliver_masonry_grid.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/src/rendering/sliver_masonry_grid.dart b/lib/src/rendering/sliver_masonry_grid.dart index 189f0bd..16f63b4 100644 --- a/lib/src/rendering/sliver_masonry_grid.dart +++ b/lib/src/rendering/sliver_masonry_grid.dart @@ -569,7 +569,12 @@ class RenderSliverMasonryGrid extends RenderSliverMultiBoxAdaptor { while (scrollOffsets .every((offset) => offset - mainAxisSpacing < scrollOffset)) { leadingGarbage += 1; - if (!advance()) { + final tag = !advance(); + if (lastChild == trailingChildWithLayout) { + // trigger the last, but this call the last few children not collectGarbage + return; + } + if (tag) { assert(leadingGarbage == childCount); assert(child == null); // we want to make sure we keep the last child around so we know the end scroll offset