2026-03-18 13:35:25 +08:00
|
|
|
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;
|
2026-04-01 00:42:34 +08:00
|
|
|
static const double minEventCardWidth = 30;
|
2026-03-18 13:35:25 +08:00
|
|
|
|
|
|
|
|
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;
|
2026-04-01 00:42:34 +08:00
|
|
|
return width < 0 ? 0 : width;
|
2026-03-18 13:35:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int clampMinuteOfDay(int minute) {
|
2026-04-01 00:42:34 +08:00
|
|
|
return minute.clamp(0, minutesInDay);
|
2026-03-18 13:35:25 +08:00
|
|
|
}
|
|
|
|
|
}
|