onSelectedTap method

void onSelectedTap()

Implementation

void onSelectedTap() {
  if (widget.keysArray.length == index) {
    widget.widgetKey[index - 1].currentState?.onButtonTap();
    widget.widgetKey[index - 1].currentState?.setState(() {
      widget.widgetKey[index - 1].currentState?.showROverlay = false;
    });

    setState(() {
      index = widget.initialIndex;
    });
  } else {
    if (index > widget.initialIndex) {
      widget.widgetKey[index - 1].currentState?.setState(() {
        widget.widgetKey[index - 1].currentState?.showROverlay = false;
      });
      widget.widgetKey[index - 1].currentState?.onButtonTap();
    }

    widget.widgetKey[index].currentState?.setState(() {
      widget.widgetKey[index].currentState?.showROverlay = false;
    });
    widget.widgetKey[index].currentState?.onButtonTap();
    widget.widgetKey[index].currentState?.setState(() {
      widget.widgetKey[index].currentState?.showROverlay = true;
    });
    setState(() {
      index = index + 1;
    });
  }
}