feat(workspace): 桌面工作区、主题与交互更新,发布 0.1.2
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
This commit was merged in pull request #13.
This commit is contained in:
1 parent
aa5255d1e4
commit
abc1868550
260 files changed
+43964
-5591
No files matched your search
@@ -0,0 +1,285 @@
|
||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widget_previews.dart';
|
||||
|
||||
import '../../app/editor_theme.dart';
|
||||
|
||||
@Preview(
|
||||
name: 'Full timecode — light',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(640, 152),
|
||||
)
|
||||
Widget timecodeRulerLightPreview() => _preview(Brightness.light);
|
||||
|
||||
@Preview(
|
||||
name: 'Full timecode — dark',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(640, 152),
|
||||
)
|
||||
@Preview(
|
||||
name: 'Full timecode — narrow',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(320, 152),
|
||||
)
|
||||
Widget timecodeRulerDarkPreview() => _preview(Brightness.dark);
|
||||
|
||||
@Preview(
|
||||
name: 'Full timecode — frame detail',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(640, 152),
|
||||
)
|
||||
Widget timecodeRulerFramePreview() =>
|
||||
_preview(Brightness.dark, frameDetail: true);
|
||||
|
||||
@Preview(
|
||||
name: 'Full timecode — 29.97 drop frame',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(640, 152),
|
||||
)
|
||||
Widget timecodeRulerDropFramePreview() => _preview(
|
||||
Brightness.dark,
|
||||
frameDetail: true,
|
||||
format: TimelineFormat(
|
||||
frameDuration: RationalTime(1001, 30000),
|
||||
timecodeFormat: TimelineTimecodeFormat.dropFrame,
|
||||
),
|
||||
);
|
||||
|
||||
@Preview(
|
||||
name: 'Centered timecode — light',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(640, 152),
|
||||
)
|
||||
Widget centeredTimecodeRulerLightPreview() => _preview(
|
||||
Brightness.light,
|
||||
timecodeLayout: TimelineRulerTimecodeLayout.centered,
|
||||
);
|
||||
|
||||
@Preview(
|
||||
name: 'Centered timecode — dark',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(640, 152),
|
||||
)
|
||||
@Preview(
|
||||
name: 'Centered timecode — narrow',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(320, 152),
|
||||
)
|
||||
Widget centeredTimecodeRulerDarkPreview() => _preview(
|
||||
Brightness.dark,
|
||||
timecodeLayout: TimelineRulerTimecodeLayout.centered,
|
||||
);
|
||||
|
||||
@Preview(
|
||||
name: 'Centered timecode — frame detail',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(640, 152),
|
||||
)
|
||||
Widget centeredTimecodeRulerFramePreview() => _preview(
|
||||
Brightness.dark,
|
||||
frameDetail: true,
|
||||
timecodeLayout: TimelineRulerTimecodeLayout.centered,
|
||||
);
|
||||
|
||||
@Preview(
|
||||
name: 'Overlay timecode — light',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(640, 152),
|
||||
)
|
||||
Widget overlayTimecodeRulerLightPreview() => _preview(
|
||||
Brightness.light,
|
||||
timecodeLayout: TimelineRulerTimecodeLayout.overlay,
|
||||
);
|
||||
|
||||
@Preview(
|
||||
name: 'Overlay timecode — dark',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(640, 152),
|
||||
)
|
||||
@Preview(
|
||||
name: 'Overlay timecode — narrow',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(320, 152),
|
||||
)
|
||||
Widget overlayTimecodeRulerDarkPreview() => _preview(
|
||||
Brightness.dark,
|
||||
timecodeLayout: TimelineRulerTimecodeLayout.overlay,
|
||||
);
|
||||
|
||||
@Preview(
|
||||
name: 'Overlay timecode — frame detail',
|
||||
group: 'Desktop timeline',
|
||||
size: Size(640, 152),
|
||||
)
|
||||
Widget overlayTimecodeRulerFramePreview() => _preview(
|
||||
Brightness.dark,
|
||||
frameDetail: true,
|
||||
timecodeLayout: TimelineRulerTimecodeLayout.overlay,
|
||||
);
|
||||
|
||||
Widget _preview(
|
||||
Brightness brightness, {
|
||||
bool frameDetail = false,
|
||||
TimelineFormat? format,
|
||||
TimelineRulerTimecodeLayout timecodeLayout =
|
||||
TimelineRulerTimecodeLayout.inline,
|
||||
}) => MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: EditorTheme.desktop(
|
||||
EditorTheme.forPalette(AppPalette.graphite, brightness),
|
||||
),
|
||||
home: Scaffold(
|
||||
body: _RulerPreview(
|
||||
format: format ?? TimelineFormat.fps30,
|
||||
frameDetail: frameDetail,
|
||||
timecodeLayout: timecodeLayout,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
class _RulerPreview extends StatefulWidget {
|
||||
const _RulerPreview({
|
||||
required this.format,
|
||||
required this.frameDetail,
|
||||
required this.timecodeLayout,
|
||||
});
|
||||
|
||||
final TimelineFormat format;
|
||||
final bool frameDetail;
|
||||
final TimelineRulerTimecodeLayout timecodeLayout;
|
||||
|
||||
@override
|
||||
State<_RulerPreview> createState() => _RulerPreviewState();
|
||||
}
|
||||
|
||||
class _RulerPreviewState extends State<_RulerPreview> {
|
||||
late final TimelineViewController _controller;
|
||||
static const _width = 640.0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final duration = RationalTime.seconds(widget.frameDetail ? 60 : 15);
|
||||
final kernel = TimelineKernel.importDto(
|
||||
TimelineDto(
|
||||
id: SequenceId('ruler-preview'),
|
||||
format: widget.format,
|
||||
primaryStorylineId: StorylineId('primary'),
|
||||
storylines: [
|
||||
StorylineDto(
|
||||
id: StorylineId('primary'),
|
||||
elementIds: [ElementId('intro'), ElementId('main')],
|
||||
),
|
||||
],
|
||||
elements: [
|
||||
for (final (id, name) in [('intro', 'Intro'), ('main', 'Main shot')])
|
||||
ElementDto(
|
||||
id: ElementId(id),
|
||||
name: name,
|
||||
structure: ElementStructure.content,
|
||||
sourceRange: TimeRange(
|
||||
start: RationalTime.zero,
|
||||
duration: duration,
|
||||
),
|
||||
duration: duration,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
final projection = const TimelineLayoutSceneBuilder().project(
|
||||
version: kernel.current,
|
||||
stacks: const [],
|
||||
appearance: (_, _, _) => throw StateError('no connections'),
|
||||
);
|
||||
final layout = TimelineLayoutEngine(kernel: kernel).initializeProjection(
|
||||
kernel: kernel,
|
||||
projection: projection,
|
||||
policy: LayoutPolicy(version: 1, stacks: const []),
|
||||
);
|
||||
final camera = TimelineCamera(
|
||||
baseTick: widget.frameDetail ? 59 * TimelineClock.ticksPerSecond : 0,
|
||||
pixelsPerTick: widget.frameDetail
|
||||
? 12 / widget.format.frameGrid.quantumTicks
|
||||
: 30 / TimelineClock.ticksPerSecond,
|
||||
);
|
||||
_controller =
|
||||
TimelineViewController(
|
||||
version: layout.version,
|
||||
storyline: kernel.current.query().primaryStoryline,
|
||||
geometry: TimelineViewportGeometry(primaryTop: 0, primaryHeight: 48),
|
||||
format: widget.format,
|
||||
camera: camera,
|
||||
)..restoreViewState(
|
||||
playheadTick: widget.frameDetail
|
||||
? (widget.format.frameDuration.denominator /
|
||||
widget.format.frameDuration.numerator)
|
||||
.round() *
|
||||
60 *
|
||||
widget.format.frameGrid.quantumTicks
|
||||
: 10 * TimelineClock.ticksPerSecond,
|
||||
camera: camera,
|
||||
);
|
||||
}
|
||||
|
||||
void _zoom(double scale, double width) => _controller.zoomBy(
|
||||
scale: scale,
|
||||
viewport: TimelineViewportRect(width: width, height: 88),
|
||||
);
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final width = constraints.hasBoundedWidth ? constraints.maxWidth : _width;
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: AppDesktopMetrics.timelineToolbar,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
const Text('Timeline ruler'),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
tooltip: 'Zoom out',
|
||||
onPressed: () => _zoom(1 / 1.4, width),
|
||||
icon: const Icon(AppIcons.remove, size: 16),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Zoom in',
|
||||
onPressed: () => _zoom(1.4, width),
|
||||
icon: const Icon(AppIcons.add, size: 16),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Fit timeline',
|
||||
onPressed: _controller.fitTimeline,
|
||||
icon: const Icon(AppIcons.fitContent, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TimelineViewport(
|
||||
controller: _controller,
|
||||
rulerStyle: TimelineRulerStyle.timecode,
|
||||
rulerTimecodeLayout: widget.timecodeLayout,
|
||||
child: TimelineView(controller: _controller),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user