31 lines
848 B
Dart
31 lines
848 B
Dart
import 'day_view_scale.dart';
|
|
|
|
class DayTimelineMetrics {
|
|
static const int hoursInDay = 24;
|
|
static const int minutesInHour = 60;
|
|
static const int minutesInDay = hoursInDay * minutesInHour;
|
|
|
|
static const double timeLabelWidth = 44;
|
|
static const double timeLabelGap = 8;
|
|
static const double eventRightInset = 4;
|
|
static const double eventColumnGap = 4;
|
|
static const double minEventCardWidth = 30;
|
|
|
|
static double timelineHeight(DayViewScale scale) {
|
|
return scale.pixelsForMinutes(minutesInDay);
|
|
}
|
|
|
|
static double eventAreaLeft() {
|
|
return timeLabelWidth + timeLabelGap;
|
|
}
|
|
|
|
static double eventAreaWidth(double boardWidth) {
|
|
final width = boardWidth - eventAreaLeft() - eventRightInset;
|
|
return width < 0 ? 0 : width;
|
|
}
|
|
|
|
static int clampMinuteOfDay(int minute) {
|
|
return minute.clamp(0, minutesInDay);
|
|
}
|
|
}
|