onDragEnd method
Called when a drag gesture ends.
Implementation
void onDragEnd(DragEndDetails details) {
isDone.value = true; // Mark dragging as finished.
// Snap the wheel to the final top item's position.
final itemCount = widget.items.length;
final step = 2 * pi / itemCount;
final rawIndex = -data.value / step;
final snappedIndex = rawIndex.round();
data.value = -snappedIndex * step;
widget.onChangeIndex(topIndex.value);
// Switch to linear layout if the style is set to linear.
if (widget.navigationStyle == NavigationStyle.linear) {
isLinearLayout.value = true;
}
}