hideListOverlay method
Implementation
Future<void> hideListOverlay(double location) async {
if (!isOverlayVisible || _isHidingOverlay) return;
_isHidingOverlay = true;
try {
await _scrollController.animateTo(
listPadding -
_adjustedTopOffset +
lastSelectedItem * _currentList.itemHeight(),
duration: scrollToListElementAnimationDuration,
curve: Curves.ease,
);
} catch (_) {
// The scroll animation throws when the list is disposed mid-animation.
} finally {
_currentList.setSelectedItemIndex(lastSelectedItem);
await Future.delayed(Duration(milliseconds: 200));
await fadeAnimationController.reverse();
if (mounted) {
setState(() {
_resetOverlayState();
});
} else {
_resetOverlayState();
}
_isHidingOverlay = false;
}
}