calculateScrollTabbarItemInfo method
Implementation
ScrollItemInfo calculateScrollTabbarItemInfo(
double? page, List<Size> sizeList) {
_progress = page! % 1.0;
///确定当前索引值位置
if (page > _lastPage!) {
if (page.toInt() > _lastPage!.toInt()) {
_currentIndex = page.toInt();
} else {
_currentIndex = _lastPage!.toInt();
_progress = _progress == 0 ? 1 : _progress;
}
} else {
_currentIndex = page.toInt();
}
_lastPage = page;
//获取下一个Item的Size
Size nextIndexItemSize = Size(-1, -1);
if (_currentIndex < sizeList.length - 1) {
nextIndexItemSize = sizeList[_currentIndex + 1];
}
return ScrollItemInfo.obtain(
_currentIndex,
getTargetItemScrollEndOffset(sizeList, _currentIndex),
sizeList[_currentIndex],
nextIndexItemSize,
_progress,
getTabBarSize(sizeList),
sizeList.length);
}