This commit is contained in:
2026-03-04 14:16:51 +01:00
parent 1cca200eda
commit 765aa83fb6
24 changed files with 1370 additions and 424 deletions

View File

@@ -169,6 +169,47 @@ class _MainAppState extends State<MainApp> {
});
}
void _onEntryResized(
TimelineEntry entry,
DateTime newStart,
DateTime newEnd,
int newLane,
) {
// Optimistic update -- apply locally before the host round-trips.
if (_state case final state?) {
final oldItem = state.items[entry.id];
if (oldItem != null) {
final updatedItems = Map<String, TimelineItemData>.of(state.items);
updatedItems[entry.id] = TimelineItemData(
id: oldItem.id,
groupId: oldItem.groupId,
title: oldItem.title,
description: oldItem.description,
start: newStart.toIso8601String(),
end: entry.hasEnd ? newEnd.toIso8601String() : null,
lane: newLane,
);
final updatedState = TimelineState(
timeline: state.timeline,
groups: state.groups,
items: updatedItems,
groupOrder: state.groupOrder,
selectedItemId: state.selectedItemId,
darkMode: state.darkMode,
);
_applyState(updatedState);
}
}
emitEvent('entry_resized', <String, Object?>{
'entryId': entry.id,
'newStart': newStart.toIso8601String(),
'newEnd': entry.hasEnd ? newEnd.toIso8601String() : null,
'groupId': entry.groupId,
'lane': newLane,
});
}
void _emitContentHeight() {
// Start with the fixed chrome heights.
var totalHeight = _tieredHeaderHeight + _breadcrumbHeight;
@@ -242,6 +283,7 @@ class _MainAppState extends State<MainApp> {
colorBuilder: _colorForEntry,
enableDrag: true,
onEntryMoved: _onEntryMoved,
onEntryResized: _onEntryResized,
),
),
),