diff --git a/lib/widgets/album/grid/list_known_extent.dart b/lib/widgets/album/grid/list_known_extent.dart index 21b75b769..020f4a61d 100644 --- a/lib/widgets/album/grid/list_known_extent.dart +++ b/lib/widgets/album/grid/list_known_extent.dart @@ -46,18 +46,18 @@ class RenderSliverKnownExtentBoxAdaptor extends RenderSliverMultiBoxAdaptor { SectionLayout sectionAtIndex(int index) => sectionLayouts.firstWhere((section) => section.hasChild(index), orElse: () => null); - SectionLayout sectionAtOffset(double scrollOffset) => sectionLayouts.firstWhere((section) => section.hasChildAtOffset(scrollOffset), orElse: () => null); + SectionLayout sectionAtOffset(double scrollOffset) => sectionLayouts.firstWhere((section) => section.hasChildAtOffset(scrollOffset), orElse: () => sectionLayouts.last); double indexToLayoutOffset(int index) { return (sectionAtIndex(index) ?? sectionLayouts.last).indexToLayoutOffset(index); } int getMinChildIndexForScrollOffset(double scrollOffset) { - return sectionAtOffset(scrollOffset)?.getMinChildIndexForScrollOffset(scrollOffset) ?? 0; + return sectionAtOffset(scrollOffset).getMinChildIndexForScrollOffset(scrollOffset); } int getMaxChildIndexForScrollOffset(double scrollOffset) { - return (sectionAtOffset(scrollOffset) ?? sectionLayouts.last).getMaxChildIndexForScrollOffset(scrollOffset); + return sectionAtOffset(scrollOffset).getMaxChildIndexForScrollOffset(scrollOffset); } double estimateMaxScrollOffset(