isInTarbarVisible method
bool
isInTarbarVisible(
- dynamic index,
- Size tabBarViewSize,
- List<
Size> ? sizeList, - ScrollController scrollController,
Implementation
bool isInTarbarVisible(
index,
Size tabBarViewSize,
List<Size>? sizeList,
ScrollController scrollController,
) {
final pixels = scrollController.position.pixels;
final startStartOffset = getTargetStartOffset(sizeList, index);
final startEndOffset = getTargetEndOffset(sizeList, index);
final tabBarViewWidth = tabBarViewSize.width;
final tabBarViewHeight = tabBarViewSize.height;
final offsetStartX = startStartOffset.dx;
final offsetStartY = startStartOffset.dy;
final offsetEndX = startEndOffset.dy;
final offsetEndY = startEndOffset.dy;
// offsetEnd == pixels, -> tab end is tabBarView start boundary
// offsetStart == pixels + tabBarViewWidth, -> tab start is tabBarView end boundary
return direction == Axis.horizontal
? offsetEndX > pixels && offsetStartX < pixels + tabBarViewWidth
: offsetEndY > pixels && offsetStartY < pixels + tabBarViewHeight;
}