isBelowOffsetWidgetInSliver static method
Determines whether the offset at the bottom of the target child widget is below the specified offset.
Implementation
static bool isBelowOffsetWidgetInSliver({
required double scrollViewOffset,
required Axis scrollDirection,
required RenderBox targetChild,
double toNextOverPercent = 1,
}) {
if (!targetChild.hasSize) return false;
final parentData = targetChild.parentData;
if (parentData is! SliverMultiBoxAdaptorParentData) {
return false;
}
final targetFirstChildOffset = parentData.layoutOffset ?? 0;
final double targetFirstChildSize;
try {
// In some cases, getting size may throw an exception.
targetFirstChildSize = scrollDirection == Axis.vertical
? targetChild.size.height
: targetChild.size.width;
} catch (_) {
return false;
}
return scrollViewOffset <
targetFirstChildSize * toNextOverPercent + targetFirstChildOffset;
}