clickState method
Rotates the menu to the selected item when it's clicked.
Implementation
void clickState(int clickedIndex) {
final itemCount = widget.items.length;
final step = 2 * pi / itemCount;
final canonicalAngle = -clickedIndex * step;
final k = ((data.value - canonicalAngle) / (2 * pi)).round();
final targetAngle = canonicalAngle + k * (2 * pi);
data.value = targetAngle;
topIndex.value = clickedIndex;
widget.onChangeIndex(topIndex.value); // Notify the parent widget of the index change.
// Switch to linear layout if the style is set to linear.
if (widget.navigationStyle == NavigationStyle.linear) {
isLinearLayout.value = true;
}
}