30 lines
810 B
Dart
30 lines
810 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 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 ? width : 0;
|
|
}
|
|
|
|
static int clampMinuteOfDay(int minute) {
|
|
return minute.clamp(0, minutesInDay).toInt();
|
|
}
|
|
}
|