toggleListOverlayVisibility method

Future toggleListOverlayVisibility(
  1. DirectSelectList visibleList,
  2. double location
)
override

Implementation

Future toggleListOverlayVisibility(
    DirectSelectList visibleList, double location) async {
  if (isOverlayVisible) {
    try {
      await _scrollController.animateTo(
        listPadding -
            _adjustedTopOffset +
            lastSelectedItem * _currentList.itemHeight(),
        duration: scrollToListElementAnimationDuration,
        curve: Curves.ease,
      );
    } catch (e) {} finally {
      _currentList.setSelectedItemIndex(lastSelectedItem);
      await Future.delayed(Duration(milliseconds: 200));
      await fadeAnimationController.reverse();
      setState(() {
        _hideListOverlay();
      });
    }
  } else {
    setState(() {
      _showListOverlay(visibleList, location);
    });
  }
}