calculateDistanceFromStart method
Calculates the distance from the start of the day to the start of the event.
event - The event to calculate the distance from.
- Note: this takes into account the TimeOfDayRange of the EventLayoutDelegate.
Implementation
double calculateDistanceFromStart(CalendarEvent event) {
final eventStart = event.internalRange(location: location).dateTimeRangeOnDate(date)?.start ?? date.startOfDay;
final dateStart = timeOfDayRange.start.toInternalDateTime(date);
final difference = eventStart.difference(dateStart);
final height = difference.inSeconds * heightPerMinute / 60;
return height;
}