feat: initial Cutdex application

Add the Flutter video editing application with project management, media
import, timeline editing, preview, AI assistance, diagnostics and settings.

Include shared UI and native host packages, platform runners, application
tests and release tooling.

Provide usage and contribution guides, the MIT license and third-party
notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
lingjhf committed 2026-10-05 23:36:23 +08:00
commit 27e77fff39
718 files changed
+183958

No files matched your search

@@ -0,0 +1,146 @@
import 'dart:math' as math;
import 'package:flutter/material.dart';
import '../../../integrations/platform/device_experience.dart';
import '../../../l10n/l10n.dart';
import 'package:cutdex_ui/theme.dart';
import '../editor_presentation_controller.dart';
/// Space changes the tool bounds; device experience determines its interactions.
class BoundedEditorLayout extends StatelessWidget {
const BoundedEditorLayout({
super.key,
required this.experience,
required this.editing,
required this.tool,
required this.media,
required this.properties,
required this.onCloseTool,
});
final DeviceExperience experience;
final Widget editing;
final EditorTool? tool;
final Widget media;
final Widget properties;
final VoidCallback onCloseTool;
@override
Widget build(BuildContext context) => LayoutBuilder(
builder: (context, constraints) {
final page = experience == DeviceExperience.phone;
final desktop = experience == DeviceExperience.desktop;
Widget toolSurface() => Column(
children: [
SizedBox(
height: desktop ? AppControlSize.panelHeader : 48,
child: Row(
children: [
SizedBox.square(
dimension: desktop ? AppControlSize.headerButton : 48,
child: IconButton(
key: const Key('editor-tool-close'),
tooltip: MaterialLocalizations.of(context)
.closeButtonTooltip,
onPressed: onCloseTool,
icon: Icon(page ? Icons.arrow_back : Icons.close),
),
),
Expanded(
child: Text(
tool == EditorTool.media
? context.l10n.materials
: context.l10n.expandProperties,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
),
const Divider(height: 1),
Expanded(child: tool == EditorTool.media ? media : properties),
],
);
return PopScope<Object?>(
canPop: desktop || tool == null,
onPopInvokedWithResult: (didPop, result) {
if (didPop || desktop || tool == null) return;
final scaffold = Scaffold.maybeOf(context);
if (scaffold?.isDrawerOpen ?? false) {
scaffold!.closeDrawer();
} else {
onCloseTool();
}
},
child: Stack(
key: Key('${experience.name}-editor-tools'),
fit: StackFit.expand,
children: [
ExcludeFocus(
excluding: page && tool != null,
child: IgnorePointer(
ignoring: page && tool != null,
child: TickerMode(
enabled: !page || tool == null,
child: editing,
),
),
),
if (tool != null)
Positioned(
top: 0,
bottom: 0,
right: 0,
width: page
? constraints.maxWidth
: math.min(320, constraints.maxWidth),
child: Material(
key: const Key('editor-tool-surface'),
elevation: page ? 0 : 8,
color: Theme.of(context).colorScheme.surface,
child: toolSurface(),
),
),
],
),
);
},
);
}
/// A shared preview/timeline arrangement for touch experiences.
class TouchEditingLayout extends StatelessWidget {
const TouchEditingLayout({
super.key,
required this.preview,
required this.timeline,
});
final Widget preview;
final Widget timeline;
@override
Widget build(BuildContext context) => LayoutBuilder(
builder: (context, constraints) {
final short = constraints.maxHeight < 340 && constraints.maxWidth >= 600;
return short
? Row(
children: [
Expanded(child: preview),
const VerticalDivider(width: 1),
Expanded(child: timeline),
],
)
: Column(
children: [
Expanded(flex: 3, child: preview),
const Divider(height: 1),
Expanded(flex: 2, child: timeline),
],
);
},
);
}
@@ -0,0 +1,145 @@
import 'dart:math' as math;
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import '../../../shared/layout/workspace_layout_metrics.dart';
class ExpandedEditorLayout extends StatefulWidget {
const ExpandedEditorLayout({
super.key,
required this.preview,
required this.properties,
required this.media,
required this.showMedia,
required this.showProperties,
required this.timelineHeight,
required this.onTimelineHeightChanged,
required this.onTimelineHeightChangeEnd,
required this.timeline,
});
final Widget preview;
final Widget properties;
final Widget media;
final bool showMedia;
final bool showProperties;
final double? timelineHeight;
final ValueChanged<double> onTimelineHeightChanged;
final VoidCallback onTimelineHeightChangeEnd;
final Widget timeline;
@override
State<ExpandedEditorLayout> createState() => _ExpandedEditorLayoutState();
}
class _ExpandedEditorLayoutState extends State<ExpandedEditorLayout> {
double? _timelineDragStartY;
double _timelineDragStartHeight = 0;
@override
Widget build(BuildContext context) => LayoutBuilder(
builder: (context, constraints) {
final maximum = math.max(
0.0,
constraints.maxHeight - WorkspaceLayoutMetrics.timelineMinimumHeight,
);
final minimum = math.min(
WorkspaceLayoutMetrics.timelineMinimumHeight,
maximum,
);
final timelineHeight =
(widget.timelineHeight ??
constraints.maxHeight *
WorkspaceLayoutMetrics.timelineDefaultHeightFraction)
.clamp(minimum, maximum)
.toDouble();
final mediaWidth = widget.showMedia
? WorkspaceLayoutMetrics.mediaPanelWidth
: 0.0;
final propertiesWidth = widget.showProperties
? WorkspaceLayoutMetrics.propertiesPanelWidth
: 0.0;
return Stack(
fit: StackFit.expand,
children: [
Column(
children: [
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (widget.showMedia) ...[
SizedBox(
key: const Key('editor-media-region'),
width: mediaWidth,
child: widget.media,
),
const VerticalDivider(width: 1),
],
Expanded(child: widget.preview),
if (widget.showProperties) ...[
const VerticalDivider(width: 1),
SizedBox(
key: const Key('editor-properties-region'),
width: propertiesWidth,
child: widget.properties,
),
],
],
),
),
const SizedBox(height: 1),
SizedBox(height: timelineHeight, child: widget.timeline),
],
),
Positioned(
key: const Key('editor-timeline-divider'),
left: 0,
right: 0,
bottom: timelineHeight - 4,
height: 8,
child: MouseRegion(
cursor: SystemMouseCursors.resizeRow,
child: GestureDetector(
key: const Key('editor-timeline-resize'),
behavior: HitTestBehavior.opaque,
dragStartBehavior: DragStartBehavior.down,
onVerticalDragStart: (details) {
_timelineDragStartY = details.globalPosition.dy;
_timelineDragStartHeight = timelineHeight;
},
onVerticalDragUpdate: (details) {
final start = _timelineDragStartY;
if (start == null) return;
widget.onTimelineHeightChanged(
(_timelineDragStartHeight +
start -
details.globalPosition.dy)
.clamp(minimum, maximum)
.toDouble(),
);
},
onVerticalDragEnd: (_) {
_timelineDragStartY = null;
widget.onTimelineHeightChangeEnd();
},
onVerticalDragCancel: () {
_timelineDragStartY = null;
widget.onTimelineHeightChangeEnd();
},
child: const Center(
child: SizedBox(
height: 1,
width: double.infinity,
child: Divider(height: 1),
),
),
),
),
),
],
);
},
);
}