changeIndex method

void changeIndex({
  1. int? newIndex,
})

Implementation

void changeIndex({int? newIndex}) {
  currentIndex = newIndex;
  if (currentIndex! <= 0) {
    currentIndex = 0;
  } else if (currentIndex! >= stories.length) {
    currentIndex = stories.length - 1;
  }
  animationController.reset();
  animationController.duration = currentStory.duration;
  _callFunctions(_onIndexChangeds);
}