handle drag n drop
This commit is contained in:
@@ -8,6 +8,7 @@ class TimelineEntry {
|
||||
required this.start,
|
||||
required this.end,
|
||||
required this.lane,
|
||||
this.hasEnd = true,
|
||||
}) : assert(!end.isBefore(start), 'Entry end must be on/after start');
|
||||
|
||||
final String id;
|
||||
@@ -15,6 +16,7 @@ class TimelineEntry {
|
||||
final DateTime start;
|
||||
final DateTime end;
|
||||
final int lane; // provided by consumer for stacking
|
||||
final bool hasEnd; // false for point-events (end is synthetic)
|
||||
|
||||
bool overlaps(DateTime a, DateTime b) {
|
||||
return !(end.isBefore(a) || start.isAfter(b));
|
||||
@@ -26,6 +28,7 @@ class TimelineEntry {
|
||||
DateTime? start,
|
||||
DateTime? end,
|
||||
int? lane,
|
||||
bool? hasEnd,
|
||||
}) {
|
||||
return TimelineEntry(
|
||||
id: id ?? this.id,
|
||||
@@ -33,11 +36,12 @@ class TimelineEntry {
|
||||
start: start ?? this.start,
|
||||
end: end ?? this.end,
|
||||
lane: lane ?? this.lane,
|
||||
hasEnd: hasEnd ?? this.hasEnd,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(id, groupId, start, end, lane);
|
||||
int get hashCode => Object.hash(id, groupId, start, end, lane, hasEnd);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
@@ -46,10 +50,11 @@ class TimelineEntry {
|
||||
other.groupId == groupId &&
|
||||
other.start == start &&
|
||||
other.end == end &&
|
||||
other.lane == lane;
|
||||
other.lane == lane &&
|
||||
other.hasEnd == hasEnd;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
'TimelineEntry(id: $id, groupId: $groupId, start: $start, end: $end, lane: $lane)';
|
||||
'TimelineEntry(id: $id, groupId: $groupId, start: $start, end: $end, lane: $lane, hasEnd: $hasEnd)';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user