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.height == -1 &&
!info.isLast) return;
double left = 0;
double right = 0;
double top = 0;
double bottom = 0;
if (this.width == null) {
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 {
left = info.currentItemScrollEndOffset.dx -
(info.currentItemSize.width + this.width!) / 2 +
(info.currentItemSize.width + info.nextItemSize.width) /
2 *
info.progress;
right = info.tabBarSize.width - left - this.width!;
}
notifier.value = IndicatorPosition(left, right, top, bottom);
controller.forEachListenerCallback();
}