computeScrollTabItem method

ScrollTabItem computeScrollTabItem(
  1. double page,
  2. List<Size> sizeList
)

Implementation

ScrollTabItem computeScrollTabItem(double page, List<Size> sizeList) {
  final prevIndex = page.toInt();
  final targetIndex = _targetIndex;
  final currentIndex = _currentIndex;
  final currentItemSize = sizeList[prevIndex];
  final sizeLength = sizeList.length;

  final totalTabBarSize = getTotalTabBarSize(sizeList);
  final totalTabBarLength = sizeList.length;

  final nextItemSize = prevIndex < sizeLength - 1
      ? sizeList[prevIndex + 1]
      : const Size(-1, -1);

  return ScrollTabItem.obtain(
    _targetIndex > _currentIndex ? 1 : -1,
    page % 1.0,
    targetIndex,
    currentIndex,
    getTargetEndOffset(sizeList, prevIndex),
    totalTabBarLength,
    totalTabBarSize,
    currentItemSize,
    nextItemSize,
  );
}