buildHourLabels function

List<String> buildHourLabels(
  1. PlannerConfig config
)

The hour-label strings shown down the left column, one per hour row from PlannerConfig.minHour to PlannerConfig.maxHour inclusive.

Each hour is rendered with PlannerConfig.hourLabelFormatter when provided, otherwise as the bare hour integer. Kept as a pure function (rather than inlined in HourColumn) so the row count and formatting are unit-testable without a canvas.

Implementation

List<String> buildHourLabels(PlannerConfig config) {
  final format = config.hourLabelFormatter ?? (int hour) => hour.toString();
  return [
    for (int hour = config.minHour; hour <= config.maxHour; hour++)
      format(hour),
  ];
}