buildYearMonths method

Widget buildYearMonths(
  1. BuildContext context
)

Implementation

Widget buildYearMonths(BuildContext context) {
  final List<Row> monthRows = <Row>[];
  final List<MonthView> monthRowChildren = <MonthView>[];

  for (int month = 1; month <= DateTime.monthsPerYear; month++) {
    monthRowChildren.add(
      MonthView(
        context: context,
        year: year,
        month: month,
        padding: monthViewPadding,
        currentDateColor: currentDateColor,
        highlightedDates: highlightedDates,
        highlightedDateColor: highlightedDateColor,
        monthNames: monthNames,
        onTap: onMonthTap,
        titleStyle: monthTitleStyle,
      ),
    );

    if (month % 3 == 0) {
      monthRows.add(
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: List<MonthView>.from(monthRowChildren),
        ),
      );
      monthRowChildren.clear();
    }
  }

  return Column(
    children: List<Row>.from(monthRows),
  );
}