Files
cutdex/packages/cutdex_timeline_ui/example/README.md
lingjhf 06f1c26681
Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
Move editor UI into the app and release verified Core dependencies (#14)
2026-10-11 19:59:40 +00:00

84 lines
4.9 KiB
Markdown

# Timeline UI example
[简体中文](README.zh-CN.md)
Runnable macOS Flutter application using the local workspace packages.
Requires Flutter with macOS desktop support and Xcode; the example targets macOS 12 or later.
From the repository root:
```sh
cd packages/cutdex_timeline_ui/example
flutter pub get
flutter run -d macos
```
The generated 42-second, 24 fps scene includes six primary members (visual
clips, a gap, a compound clip, audio and a disabled clip), two overlapping
visual connections above, two overlapping audio connections below, and one
overlap transition. Compound contents remain inside their definition.
The app-bar menu also opens a deterministic 3-hour, 24 fps synthetic scene with
365 Primary members and 316 connected clips, including repeated visual/audio
members and overlapping title/overlay/audio attachments. These are generated
timeline records, not real decoded media or a performance benchmark. Switching
scenes retains each document's Camera and history. End navigates to the current
tail; Reset restores the initial Camera at time zero. Horizontal navigation never
passes into negative time. Hold a clip at any edge to auto-scroll;
release uses the latest Camera, while Escape/cancel stops without committing.
- Click a clip to select it and display its name; click blank space to clear.
- Move the mouse to highlight a clip.
- Drag a clip's inner left/right edge to trim; hover/selection reveals themed
grips. Serial clips ripple, connected left trim keeps the right edge, and
container trim preserves its internal definition. Edge scrolling and Undo/Redo
also work while trimming. Invalid trim releases leave the document unchanged.
- Use arrows to pan horizontally, or scroll in either axis.
- Zoom buttons retain a visible playhead; when it is offscreen, they use the viewport center.
- Click/drag the elapsed-time ruler to seek; the line shares the clip camera.
- Ctrl/Cmd+wheel retains a visible playhead (or the viewport center); Shift+wheel pans horizontally.
- Pan with Space+drag, middle-button drag or a trackpad. Mouse-drag blank space
to marquee-select; Escape cancels. Single-touch blank-space pan is preserved.
- Pinch with two fingers to zoom while retaining the visible playhead. Trackpad translation
pans when the gesture is not pinching; scale packets do not also shift the anchor.
- Toggle the theme in the title bar; Reset restores the camera and selection.
- Drag connected selections to preview avoidance, move them above/below Primary,
or insert it into Primary. Release publishes one coordinated edit.
- Escape and pointer cancellation discard the drop. Overshooting the viewport clamps
the target to its edge; horizontal overshoot keeps scrolling, and release commits
the latest preview. Audio dragged above Primary lands below it, outside incumbents.
- Undo/Redo restore the coordinated Kernel/Layout roots; Reset only resets the view.
- Blade/Delete toolbar buttons use the selected clips; with no selection, Blade cuts
only the Primary clip at the playhead and leaves connected clips unchanged. With
explicit selection, blade cuts only interiors
under the playhead, including mixed Primary/connected selections. A connected
right half anchors to the Primary at the cut. Delete cascades owned children
and closes Primary; no handoff or gap is synthesized. The focused timeline/ruler
also accepts Ctrl/Cmd+B, Delete/Backspace, Ctrl/Cmd+Z and Ctrl/Cmd+Shift+Z.
These commands are disabled during pointer editing and never add implicit cuts
to drag/drop. Rejections appear in the status line without a partial edit.
This example demonstrates drawing and connected-selection editing APIs, including
carried descendants and consecutive group insertion into Primary.
Primary groups can reorder with carried connections; direct drag transfer out of
Primary requires roots without connected children. Valid lifts close the source
magnetically (A→B→C becomes A→C). Returning to Primary resolves a boundary reorder. Primary and connected drops use pointer halves and never cut target clips.
Playback advances only the presentation playhead. Advanced trim (roll/slip/slide),
decoded media playback, thumbnails and waveforms are not implemented here. The audio
accent is a visual marker, not a generated waveform. Colors come from one
`TimelineThemeData`; all clip coordinates come from Layout.
`lib/demo_timeline.dart` builds DTOs, the Kernel and Layout, sharing one host
media classifier with `TimelineView`. `lib/main.dart` owns and disposes the
controller and uses `TimelineInteractionRegion` for pointer integration. All edits
publish through Layout; the example never directly mutates Kernel roots.
```sh
flutter test
```
Widget tests calculate clip-body and trim-edge positions from the resident Layout frame,
verify the hit target, and assert exact authored results and undo/redo roots. Trim
preview assertions pump a frame to flush the pointer update. Application CI includes
these tests and static analysis.