animateToSelection method

void animateToSelection({
  1. Duration duration = const Duration(milliseconds: 500),
  2. Curve curve = Curves.linear,
})

This function will animate the Timeline to the most recently selected date. Does nothing if no date is selected or the picker isn't laid out yet.

Implementation

void animateToSelection(
    {Duration duration = const Duration(milliseconds: 500),
    Curve curve = Curves.linear}) {
  final selected = _datePickerState?._anchorDate;
  if (selected == null) return;

  // animate to the current date
  _animateToOffset(_targetOffsetForDate(selected), duration, curve);
}