getDateTimeFromOffset function

DateTime getDateTimeFromOffset(
  1. double offset,
  2. double hourHeight,
  3. DateTime date
)

Returns the date time from the offset of the scroll. Used to access time when creating new events by drag selection. params double offset The offset of the scroll. params DateTime date for the position selected.

Implementation

DateTime getDateTimeFromOffset(
    double offset, double hourHeight, DateTime date) {
  final hour = offset ~/ hourHeight;
  final minute = ((offset % hourHeight) / hourHeight * 60).round();
  return roundUpQuarter(
      DateTime(date.year, date.month, date.day, hour, minute));
}