calcIndex method

int calcIndex(
  1. int realIndex
)

calculate the index of the current item

Implementation

int calcIndex(int realIndex) {
  if (itemCount! == 0) return 0;
  int index = (realIndex - kMiddleValue) % this.itemCount!;
  if (index < 0) {
    index += this.itemCount!;
  }
  return index;
}