calculateDayWidth method

double calculateDayWidth(
  1. double totalWidth
)

Calculates the width of a single day column based on the total available width. Returns 0 if calculation is not possible.

Implementation

double calculateDayWidth(double totalWidth) {
  _gridEndX = totalWidth - sidePadding;
  _gridWidth = _gridEndX - gridStartX;
  // Ensure daysToShow is positive to prevent division by zero or negative width
  _dayWidth = _gridWidth > 0 && daysToShow > 0 ? _gridWidth / daysToShow : 0;
  return _dayWidth;
}