navigateDown method

void navigateDown()

Navigate to next option

Implementation

void navigateDown() {
  if (_currentOptions.isEmpty) return;

  final currentIndex = _highlightedIndex.value;
  int nextIndex;

  if (currentIndex == -1) {
    // 如果没有选中任何项,选中第一项
    nextIndex = 0;
  } else if (currentIndex < _currentOptions.length - 1) {
    // 如果不是最后一项,移动到下一项
    nextIndex = currentIndex + 1;
  } else {
    // 如果已经是最后一项,保持在最后一项
    nextIndex = currentIndex;
  }

  _highlightedIndex.value = nextIndex;
  _highlightedOption.value = _currentOptions[nextIndex];

  // 自动滚动到可见位置(使用实际的widget属性)
  _scrollToIndex(nextIndex);
}