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:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,276 @@
|
||||
import '../adaptive/desktop_workspace_controller.dart';
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../workspace/workspace_mode.dart';
|
||||
import '../../shared/layout/workspace_layout_metrics.dart';
|
||||
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_native/cutdex_native.dart';
|
||||
|
||||
import '../adaptive/workspace_layout_policy.dart';
|
||||
|
||||
typedef WorkspaceSidebarBuilder = Widget Function(
|
||||
DesktopWorkspaceGeometry geometry,
|
||||
VoidCallback expandEditor,
|
||||
);
|
||||
|
||||
/// Arranges slots and handles splitters; it does not own editing sessions.
|
||||
class DesktopWorkspaceShell extends StatefulWidget {
|
||||
const DesktopWorkspaceShell({
|
||||
super.key,
|
||||
required this.mode,
|
||||
required this.controller,
|
||||
required this.sidebarCollapsed,
|
||||
required this.sidebarWidth,
|
||||
required this.onSidebarCollapsedChanged,
|
||||
required this.onSidebarWidthChanged,
|
||||
required this.sidebarBuilder,
|
||||
required this.editor,
|
||||
required this.scaffoldKey,
|
||||
required this.navigationDrawer,
|
||||
});
|
||||
|
||||
final WorkspaceMode mode;
|
||||
final DesktopWorkspaceController controller;
|
||||
final bool sidebarCollapsed;
|
||||
final double? sidebarWidth;
|
||||
final ValueChanged<bool> onSidebarCollapsedChanged;
|
||||
final ValueChanged<double> onSidebarWidthChanged;
|
||||
final WorkspaceSidebarBuilder sidebarBuilder;
|
||||
final Widget editor;
|
||||
final GlobalKey<ScaffoldState> scaffoldKey;
|
||||
final Widget navigationDrawer;
|
||||
|
||||
@override
|
||||
State<DesktopWorkspaceShell> createState() => _DesktopWorkspaceShellState();
|
||||
}
|
||||
|
||||
class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
||||
double? get _agentWidth => widget.controller.agentWidth;
|
||||
bool get _editorCollapsedByAgent => widget.controller.editorCollapsedByAgent;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.controller.addListener(_changed);
|
||||
}
|
||||
|
||||
void _changed() => setState(() {});
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant DesktopWorkspaceShell oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.controller != widget.controller) {
|
||||
oldWidget.controller.removeListener(_changed);
|
||||
widget.controller.addListener(_changed);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
widget.controller.removeListener(_changed);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
double? _sidebarDragStart;
|
||||
double _sidebarDragWidth = 0;
|
||||
double? _agentDragStart;
|
||||
double _agentDragWidth = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final width = constraints.maxWidth;
|
||||
final geometry = DesktopWorkspaceGeometry.resolve(
|
||||
width: width,
|
||||
mode: widget.mode,
|
||||
sidebarCollapsed: widget.sidebarCollapsed,
|
||||
sidebarWidth: widget.sidebarWidth,
|
||||
agentWidth: _agentWidth,
|
||||
editorCollapsedByAgent: _editorCollapsedByAgent,
|
||||
);
|
||||
final navigationSpace = widget.sidebarCollapsed
|
||||
? 0.0
|
||||
: geometry.sidebarWidth;
|
||||
void expandEditor() {
|
||||
final collapseNavigation = width - navigationSpace - 1 < 780;
|
||||
if (collapseNavigation) widget.onSidebarCollapsedChanged(true);
|
||||
widget.controller.setSplit(
|
||||
width -
|
||||
(collapseNavigation ? 0 : navigationSpace) -
|
||||
DesktopWorkspaceGeometry.editorRestoreWidth -
|
||||
1,
|
||||
editorCollapsed: false,
|
||||
);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
key: widget.scaffoldKey,
|
||||
drawer: Drawer(
|
||||
width: 320,
|
||||
child: SafeArea(child: widget.navigationDrawer),
|
||||
),
|
||||
body: Stack(
|
||||
key: const Key('desktop-workspace-shell'),
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
if (!widget.sidebarCollapsed ||
|
||||
widget.mode == WorkspaceMode.agent)
|
||||
SizedBox(
|
||||
width: navigationSpace + geometry.agentWidth,
|
||||
child: widget.sidebarBuilder(geometry, expandEditor),
|
||||
),
|
||||
if (!widget.sidebarCollapsed && !geometry.editorHidden)
|
||||
SizedBox(
|
||||
width: 1,
|
||||
height: double.infinity,
|
||||
child: ColoredBox(
|
||||
key: const Key('project-sidebar-separator'),
|
||||
color: AppTheme.sidebarDividerColor(context),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Offstage(
|
||||
key: const Key('editor-auto-collapse'),
|
||||
offstage: geometry.editorHidden,
|
||||
child: TickerMode(
|
||||
enabled: !geometry.editorHidden,
|
||||
child: OverflowBox(
|
||||
alignment: Alignment.topLeft,
|
||||
minWidth: geometry.editorHidden
|
||||
? DesktopWorkspaceGeometry.editorRestoreWidth
|
||||
: null,
|
||||
maxWidth: geometry.editorHidden
|
||||
? DesktopWorkspaceGeometry.editorRestoreWidth
|
||||
: null,
|
||||
child: WindowHeaderPane(
|
||||
offset: Offset(
|
||||
navigationSpace +
|
||||
geometry.agentWidth +
|
||||
(!widget.sidebarCollapsed &&
|
||||
!geometry.editorHidden
|
||||
? 1
|
||||
: 0),
|
||||
0,
|
||||
),
|
||||
child: widget.editor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (!widget.sidebarCollapsed)
|
||||
Positioned(
|
||||
key: const Key('project-sidebar-divider'),
|
||||
top: AppControlSize.panelHeader,
|
||||
bottom: 0,
|
||||
left: geometry.sidebarWidth - 4,
|
||||
width: 8,
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.resizeColumn,
|
||||
child: GestureDetector(
|
||||
key: const Key('project-sidebar-resize'),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
dragStartBehavior: DragStartBehavior.down,
|
||||
onHorizontalDragStart: (details) {
|
||||
_sidebarDragStart = details.globalPosition.dx;
|
||||
_sidebarDragWidth = geometry.sidebarWidth;
|
||||
},
|
||||
onHorizontalDragUpdate: (details) {
|
||||
final start = _sidebarDragStart;
|
||||
if (start == null) return;
|
||||
widget.onSidebarWidthChanged(
|
||||
(_sidebarDragWidth + details.globalPosition.dx - start)
|
||||
.clamp(
|
||||
WorkspaceLayoutMetrics.sidebarMinimumWidth,
|
||||
DesktopWorkspaceGeometry.sidebarMaximum(
|
||||
width,
|
||||
widget.mode,
|
||||
),
|
||||
)
|
||||
.toDouble(),
|
||||
);
|
||||
},
|
||||
onHorizontalDragEnd: (_) => _sidebarDragStart = null,
|
||||
onHorizontalDragCancel: () => _sidebarDragStart = null,
|
||||
child: const SizedBox.expand(),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (widget.mode == WorkspaceMode.agent &&
|
||||
width - navigationSpace - 1 >= 220)
|
||||
Positioned(
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left:
|
||||
navigationSpace +
|
||||
geometry.agentWidth -
|
||||
(geometry.editorHidden ? 8 : 4),
|
||||
width: 8,
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.resizeColumn,
|
||||
child: GestureDetector(
|
||||
key: const Key('agent-panel-resize'),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
dragStartBehavior: DragStartBehavior.down,
|
||||
onHorizontalDragStart: (details) {
|
||||
_agentDragStart = details.globalPosition.dx;
|
||||
_agentDragWidth = geometry.agentWidth;
|
||||
},
|
||||
onHorizontalDragUpdate: (details) {
|
||||
final start = _agentDragStart;
|
||||
if (start == null) return;
|
||||
final agentWidth =
|
||||
(_agentDragWidth + details.globalPosition.dx - start)
|
||||
.clamp(220.0, width - navigationSpace - 1);
|
||||
final remaining =
|
||||
width - navigationSpace - agentWidth - 1;
|
||||
widget.controller.setSplit(
|
||||
agentWidth,
|
||||
editorCollapsed: geometry.editorHidden
|
||||
? remaining <
|
||||
DesktopWorkspaceGeometry.editorRestoreWidth
|
||||
: remaining <=
|
||||
DesktopWorkspaceGeometry.editorCollapseWidth -
|
||||
DesktopWorkspaceGeometry
|
||||
.editorCollapseDragBuffer,
|
||||
);
|
||||
},
|
||||
onHorizontalDragEnd: (_) {
|
||||
_agentDragStart = null;
|
||||
if (!_editorCollapsedByAgent &&
|
||||
_agentWidth != null &&
|
||||
width -
|
||||
navigationSpace -
|
||||
DesktopWorkspaceGeometry.editorCollapseWidth -
|
||||
1 >=
|
||||
220) {
|
||||
widget.controller.setSplit(
|
||||
_agentWidth!.clamp(
|
||||
220.0,
|
||||
width -
|
||||
navigationSpace -
|
||||
DesktopWorkspaceGeometry.editorCollapseWidth -
|
||||
1,
|
||||
),
|
||||
editorCollapsed: false,
|
||||
);
|
||||
}
|
||||
},
|
||||
onHorizontalDragCancel: () => _agentDragStart = null,
|
||||
child: const SizedBox.expand(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../l10n/l10n.dart';
|
||||
|
||||
import '../../workspace/workspace_mode.dart';
|
||||
import 'workspace_frame.dart';
|
||||
|
||||
/// A focused surface; hidden features keep their state in workspace controllers.
|
||||
class PhoneWorkspaceShell extends StatelessWidget {
|
||||
const PhoneWorkspaceShell({
|
||||
super.key,
|
||||
required this.mode,
|
||||
required this.onModeChanged,
|
||||
required this.navigation,
|
||||
required this.headerActions,
|
||||
required this.title,
|
||||
required this.integratedTitlebar,
|
||||
required this.agent,
|
||||
required this.editor,
|
||||
});
|
||||
|
||||
final WorkspaceMode mode;
|
||||
final ValueChanged<WorkspaceMode> onModeChanged;
|
||||
final Widget navigation;
|
||||
final Widget headerActions;
|
||||
final String title;
|
||||
final bool integratedTitlebar;
|
||||
final Widget agent;
|
||||
final Widget editor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => WorkspaceFrame(
|
||||
key: const Key('phone-workspace-shell'),
|
||||
navigation: navigation,
|
||||
headerActions: headerActions,
|
||||
title: title,
|
||||
integratedTitlebar: integratedTitlebar,
|
||||
bottomNavigationBar: NavigationBar(
|
||||
height: 64,
|
||||
selectedIndex: mode == WorkspaceMode.agent ? 0 : 1,
|
||||
onDestinationSelected: (index) =>
|
||||
onModeChanged(index == 0 ? WorkspaceMode.agent : WorkspaceMode.cut),
|
||||
destinations: [
|
||||
NavigationDestination(
|
||||
key: const Key('workspace-agent-destination'),
|
||||
icon: const Icon(Icons.chat_bubble_outline),
|
||||
label: context.l10n.workspaceAgent,
|
||||
),
|
||||
NavigationDestination(
|
||||
key: const Key('workspace-cut-destination'),
|
||||
icon: const Icon(Icons.movie_outlined),
|
||||
label: context.l10n.workspaceCut,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: mode == WorkspaceMode.agent ? agent : editor,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../l10n/l10n.dart';
|
||||
|
||||
import '../../workspace/workspace_mode.dart';
|
||||
import '../adaptive/workspace_layout_policy.dart';
|
||||
import 'workspace_frame.dart';
|
||||
|
||||
/// Two working surfaces when space permits, with project navigation on demand.
|
||||
class TabletWorkspaceShell extends StatelessWidget {
|
||||
const TabletWorkspaceShell({
|
||||
super.key,
|
||||
required this.mode,
|
||||
required this.onModeChanged,
|
||||
required this.navigation,
|
||||
required this.headerActions,
|
||||
required this.title,
|
||||
required this.integratedTitlebar,
|
||||
required this.agent,
|
||||
required this.editor,
|
||||
});
|
||||
|
||||
final WorkspaceMode mode;
|
||||
final ValueChanged<WorkspaceMode> onModeChanged;
|
||||
final Widget navigation;
|
||||
final Widget headerActions;
|
||||
final String title;
|
||||
final bool integratedTitlebar;
|
||||
final Widget agent;
|
||||
final Widget editor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => WorkspaceFrame(
|
||||
key: const Key('tablet-workspace-shell'),
|
||||
navigation: navigation,
|
||||
headerActions: headerActions,
|
||||
title: title,
|
||||
integratedTitlebar: integratedTitlebar,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 72,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height: math.max(240, constraints.maxHeight),
|
||||
child: NavigationRail(
|
||||
selectedIndex: mode == WorkspaceMode.agent ? 0 : 1,
|
||||
labelType: NavigationRailLabelType.all,
|
||||
onDestinationSelected: (index) => onModeChanged(
|
||||
index == 0 ? WorkspaceMode.agent : WorkspaceMode.cut,
|
||||
),
|
||||
destinations: [
|
||||
NavigationRailDestination(
|
||||
icon: const Icon(
|
||||
Icons.chat_bubble_outline,
|
||||
key: Key('workspace-agent-destination'),
|
||||
),
|
||||
label: Text(context.l10n.workspaceAgent),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: const Icon(
|
||||
Icons.movie_outlined,
|
||||
key: Key('workspace-cut-destination'),
|
||||
),
|
||||
label: Text(context.l10n.workspaceCut),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const VerticalDivider(width: 1),
|
||||
Expanded(
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) =>
|
||||
mode == WorkspaceMode.agent &&
|
||||
WorkspaceLayoutPolicy.showAgentBesideEditor(
|
||||
constraints.maxWidth,
|
||||
)
|
||||
? Row(
|
||||
children: [
|
||||
SizedBox(width: constraints.maxWidth * .38, child: agent),
|
||||
const VerticalDivider(width: 1),
|
||||
Expanded(child: editor),
|
||||
],
|
||||
)
|
||||
: mode == WorkspaceMode.agent
|
||||
? agent
|
||||
: editor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../integrations/platform/editor_window_chrome.dart';
|
||||
|
||||
import 'package:cutdex_native/cutdex_native.dart';
|
||||
|
||||
import '../../l10n/l10n.dart';
|
||||
|
||||
/// Navigation and mode controls for bounded workspaces. Drawer visibility is
|
||||
/// local presentation state and never overwrites the desktop sidebar preference.
|
||||
class WorkspaceFrame extends StatelessWidget {
|
||||
const WorkspaceFrame({
|
||||
super.key,
|
||||
required this.navigation,
|
||||
required this.headerActions,
|
||||
required this.title,
|
||||
required this.integratedTitlebar,
|
||||
required this.child,
|
||||
this.bottomNavigationBar,
|
||||
});
|
||||
|
||||
final Widget navigation;
|
||||
final Widget headerActions;
|
||||
final String title;
|
||||
final bool integratedTitlebar;
|
||||
final Widget child;
|
||||
final Widget? bottomNavigationBar;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
drawer: Drawer(width: 320, child: SafeArea(child: navigation)),
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
key: const Key('workspace-window-header'),
|
||||
height: 48,
|
||||
child: WindowHeaderPadding(
|
||||
child: Row(
|
||||
children: [
|
||||
if (integratedTitlebar)
|
||||
SizedBox(width: EditorWindowChrome.leadingWidth),
|
||||
HeaderControlRegion(
|
||||
child: Builder(
|
||||
builder: (context) => IconButton(
|
||||
key: const Key('workspace-navigation-button'),
|
||||
tooltip: context.l10n.expandSidebar,
|
||||
onPressed: () => Scaffold.of(context).openDrawer(),
|
||||
icon: const Icon(Icons.menu),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
headerActions,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
Expanded(child: child),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: bottomNavigationBar,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user