centeredDateLabelOffset function
The top-left at which a date label of textSize is painted so it sits
centered within its day-column: horizontally across the column's
blockWidth (its left edge at columnLeft, shifted by the current
horizontal scroll scrollX) and vertically within the rowHeight-tall date
row. Kept as a pure function so the centering math is unit-testable without a
canvas (#28 — labels previously used a hardcoded 60
left offset and a hardcoded 20 top offset and were not centered).
Implementation
Offset centeredDateLabelOffset({
required double scrollX,
required double columnLeft,
required double blockWidth,
required double rowHeight,
required Size textSize,
}) =>
Offset(
scrollX + columnLeft + (blockWidth - textSize.width) / 2,
(rowHeight - textSize.height) / 2,
);