goto method

void goto(
  1. DateMonth month
)

跳转到指定月份

Implementation

void goto(DateMonth month) {
  if (month == _monthList[_position]) return;
  _position = CACHE_SIZE ~/ 2;
  _monthList.clear();
  _controllerList.clear();
  List.generate(CACHE_SIZE, (index) {
    addMonth(DateMonth(month.year, month.month - CACHE_SIZE ~/ 2 + index));
  });
  _pageController?.animateToPage(_position,
      duration: Duration(milliseconds: 500), curve: Curves.ease);
  changePosition(_position);
}