updateScrollIndicator method
void
updateScrollIndicator(
- double? page,
- List<
Size> ? sizeList, - Duration duration,
- ValueNotifier<
IndicatorPosition> notifier,
override
Implementation
@override
void updateScrollIndicator(double? page, List<Size>? sizeList,
Duration duration, ValueNotifier<IndicatorPosition> notifier) {
ScrollItemInfo info =
controller.calculateScrollTabbarItemInfo(page, sizeList!);
if (info.nextItemSize.width == -1 &&
info.nextItemSize.width == -1 &&
!info.isLast) return;
double left = 0;
double right = 0;
double top = 0;
double bottom = 0;
if (controller.direction == Axis.horizontal) {
left = info.currentItemScrollEndOffset.dx -
info.currentItemSize.width +
info.currentItemSize.width * info.progress;
right = info.tabBarSize.width -
info.currentItemScrollEndOffset.dx -
info.nextItemSize.width * info.progress;
} else {
top = info.currentItemScrollEndOffset.dy -
info.currentItemSize.height +
info.currentItemSize.height * info.progress;
bottom = info.tabBarSize.height -
info.currentItemScrollEndOffset.dy -
info.nextItemSize.height * info.progress;
}
notifier.value = IndicatorPosition(left, right, top, bottom);
controller.forEachListenerCallback();
}