animateToMonth method

Future<void> animateToMonth(
  1. DateTime month, {
  2. Duration? duration,
  3. Curve? curve,
})

Animate to page which gives month calendar for month.

Arguments duration and curve will override default values provided as MonthView.pageTransitionDuration and MonthView.pageTransitionCurve respectively.

Implementation

Future<void> animateToMonth(DateTime month,
    {Duration? duration, Curve? curve}) async {
  if (month.isBefore(_minDate) || month.isAfter(_maxDate)) {
    throw "Invalid date selected.";
  }
  await _pageController.animateToPage(
    _minDate.getMonthDifference(month) - 1,
    duration: duration ?? widget.pageTransitionDuration,
    curve: curve ?? widget.pageTransitionCurve,
  );
}