CalendarInfo constructor

CalendarInfo({
  1. required int year,
  2. required int month,
  3. dynamic thisVsync,
  4. required int firstWeekDay,
})

Implementation

CalendarInfo({required this.year, required this.month, this.thisVsync, required int firstWeekDay}) {
  int lastDay = DateTime(year, month + 1, 0).day;
  int monthFirstWeekDay = DateTime(year, month, 1).weekday;

  for (int i = 0; i < (monthFirstWeekDay - firstWeekDay) %7; i++) {
    dates.add(DateInfo(isSelected: SelectType.empty));
  }



  for (var i = 0; i < lastDay; i++) {
    AnimationController singleSelectedAniCtrl = AnimationController(
        vsync: thisVsync, duration: const Duration(milliseconds: 500));
    Animation<double> singleScaleTransition = Tween<double>(begin: 0, end: 1)
        .animate(CurvedAnimation(
            parent: singleSelectedAniCtrl,
            curve: Curves.easeOutBack,
            reverseCurve: Curves.easeInQuad));
    dates.add(DateInfo(
        date: i + 1,
        weekday: DateTime(year, month, i + 1).weekday,
        isSelected: SelectType.none,
        singleSelectedAniCtrl: singleSelectedAniCtrl,
        singleScaleAnimation: singleScaleTransition));
  }
}