navigateTo method

Future<void> navigateTo(
  1. int index
)

Implementation

Future<void> navigateTo(int index) async {
  if (index != itemIndex) {
    if (widget.onTap != null) {
      widget.onTap!(index);
    }
    setState(() {
      isIndexChanging = true;
    });
    await Future.delayed(
        widget.animationDuration - const Duration(milliseconds: 100));
    setState(() {
      itemIndex = index;
    });

    await Future.delayed(widget.animationDuration);
    setState(() {
      isIndexChanging = false;
    });
  }
}