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

This commit was merged in pull request #13.
This commit is contained in:
lingjhf committed 2026-10-08 18:17:12 +00:00
1 parent aa5255d1e4
commit abc1868550
260 files changed
+43964 -5591

No files matched your search

+463 -274
View File
@@ -1,3 +1,5 @@
import '../../shared/widgets/presentation_list.dart';
import 'package:cutdex/shared/widgets/error_notification_host.dart';
import 'package:cutdex/l10n/l10n.dart';
import 'package:cutdex_sdk/timeline/engine.dart';
@@ -11,24 +13,30 @@ import 'package:cutdex_sdk/timeline_ui.dart';
import '../../shared/widgets/listenable_selector.dart';
import '../../workspace/timeline_provider.dart';
import '../../workspace/projects.dart';
import '../../workspace/project_state.dart';
import '../../integrations/runtime/timeline_thumbnails.dart';
import '../../integrations/runtime/timeline_waveforms.dart';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:cutdex_ui/icons.dart';
import 'package:cutdex_ui/theme.dart';
import 'package:cutdex_ui/widgets.dart';
import '../editor/editor_panel_defaults.dart';
import '../editor/timeline_operation_region.dart';
import '../media/transcription_dialog.dart';
import '../media/media_browser_controller.dart';
import '../media/background_removal_dialog.dart';
import '../projects/widgets/name_dialog.dart';
import '../../workspace/timeline_session.dart';
import '../../workspace/preview_target.dart';
import 'timeline_asset_drop_target.dart';
import 'editor_timeline_viewport.dart';
import 'timeline_speed_editor.dart';
class EditorTimelinePanel extends StatelessWidget {
@@ -38,12 +46,18 @@ class EditorTimelinePanel extends StatelessWidget {
required this.timelineId,
this.pending = false,
this.timelineLoading = false,
this.rulerTimecodeLayout,
});
final String projectId;
final String timelineId;
final bool pending;
/// Keeps the active surface visible while disabling edits during navigation.
final bool timelineLoading;
/// An override of the desktop ruler layout selected in settings.
final TimelineRulerTimecodeLayout? rulerTimecodeLayout;
@override
Widget build(BuildContext context) => Theme(
data: AppTheme.timelinePanelTheme(Theme.of(context)),
@@ -58,15 +72,15 @@ class EditorTimelinePanel extends StatelessWidget {
),
const Divider(height: 1),
Expanded(
child: timelineLoading
? const EditorTimelineDefaults(
key: Key('timeline-pending'),
showTabs: false,
)
: _TimelineSessionContent(
projectId: projectId,
timelineId: timelineId,
),
child: TimelineOperationRegion(
projectId: projectId,
loading: timelineLoading,
child: _TimelineSessionContent(
projectId: projectId,
timelineId: timelineId,
rulerTimecodeLayout: rulerTimecodeLayout,
),
),
),
],
),
@@ -82,16 +96,34 @@ class _TimelineTabsContent extends ConsumerWidget {
final String timelineId;
@override
Widget build(BuildContext context, WidgetRef ref) {
final projectState = ref.watch(projectsProvider).asData?.value;
final timelines = projectState?.activeProject?.id == projectId
? projectState!.timelines
: const <TimelineSummary>[];
final tabs = ref.watch(
projectsProvider.select((value) {
final state = value.asData?.value;
final active = state?.activeProject?.id == projectId;
return (
active
? PresentationList(
state!.timelines.map(
(timeline) => (timeline.id, timeline.name, timeline.pinned),
),
)
: PresentationList<(String, String, bool)>(const []),
active ? state?.visibleTimelineId : null,
active && state?.creatingTimeline == true,
active ? state?.openingTimelineId : null,
);
}),
);
return _TimelineTabsBar(
projectId: projectId,
timelineId: timelineId,
timelines: timelines,
creating: projectState?.creatingTimeline ?? false,
openingTimelineId: projectState?.openingTimelineId,
timelineId: tabs.$2 ?? timelineId,
timelines:
ref.read(projectsProvider).asData?.value.activeProject?.id ==
projectId
? ref.read(projectsProvider).asData!.value.timelines
: const <TimelineSummary>[],
creating: tabs.$3,
openingTimelineId: tabs.$4,
);
}
}
@@ -100,9 +132,19 @@ class _TimelineSessionContent extends ConsumerWidget {
const _TimelineSessionContent({
required this.projectId,
required this.timelineId,
required this.rulerTimecodeLayout,
});
final String projectId;
final String timelineId;
final TimelineRulerTimecodeLayout? rulerTimecodeLayout;
void _activateTimeline(WidgetRef ref) {
ref.read(mediaBrowserProvider(projectId)).selectedAssetId = null;
ref
.read(previewNavigationProvider(projectId, timelineId).notifier)
.showTimeline();
}
@override
Widget build(BuildContext context, WidgetRef ref) {
final provider = editorTimelineProvider(projectId, timelineId);
@@ -148,11 +190,14 @@ class _TimelineSessionContent extends ConsumerWidget {
'dart pointer-down',
);
}
ref
.read(previewNavigationProvider(projectId, timelineId).notifier)
.showTimeline();
_activateTimeline(ref);
},
child: _TimelineEditor(session: session, projectId: projectId),
child: _TimelineEditor(
session: session,
projectId: projectId,
rulerTimecodeLayout: rulerTimecodeLayout,
onSelectionActivated: () => _activateTimeline(ref),
),
),
);
}
@@ -178,7 +223,10 @@ class _TimelineTabsBar extends ConsumerStatefulWidget {
}
class _TimelineTabsBarState extends ConsumerState<_TimelineTabsBar> {
static const _barHeight = 26.0;
double get _barHeight =>
AppTheme.isDesktop(context) ? AppDesktopMetrics.timelineTabs : 26.0;
double get _tabHeight =>
AppTheme.isDesktop(context) ? AppDesktopMetrics.timelineTabControl : 20;
static const _menuWidth = 220.0;
final _scrollController = ScrollController();
final _selectedMenuItemKey = GlobalKey();
@@ -320,117 +368,138 @@ class _TimelineTabsBarState extends ConsumerState<_TimelineTabsBar> {
@override
Widget build(BuildContext context) {
final desktop = AppTheme.isDesktop(context);
final actionHeight = desktop ? _tabHeight : _barHeight;
final actionStyle = desktop ? AppTheme.timelineTabActionStyle : null;
final addButton = SizedBox.square(
dimension: actionHeight,
child: IconButton(
key: const Key('timeline-add-button'),
tooltip: context.l10n.createTimelineHint,
onPressed: _createTimeline,
style: actionStyle,
padding: EdgeInsets.zero,
constraints: BoxConstraints.tightFor(
width: actionHeight,
height: actionHeight,
),
icon: const Icon(AppIcons.add, size: AppIconSize.small),
),
);
final tabList = ScrollEdgeFade(
controller: _scrollController,
axis: Axis.horizontal,
child: Listener(
onPointerSignal: (event) {
if (event is! PointerScrollEvent || !_scrollController.hasClients) {
return;
}
final delta = event.scrollDelta.dy != 0
? event.scrollDelta.dy
: event.scrollDelta.dx;
if (delta == 0) return;
final position = _scrollController.position;
_scrollController.jumpTo(
(position.pixels + delta).clamp(
position.minScrollExtent,
position.maxScrollExtent,
),
);
},
child: SingleChildScrollView(
key: const Key('timeline-tabs-list'),
controller: _scrollController,
scrollDirection: Axis.horizontal,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.tiny),
child: Row(
children: [
for (
var index = 0;
index < widget.timelines.length;
index++
) ...[
if (index > 0) const SizedBox(width: AppSpacing.hairline),
_buildTab(context, widget.timelines[index]),
],
],
),
),
),
),
);
final listButton = SizedBox.square(
dimension: actionHeight,
child: AppPopover(
width: _menuWidth,
maxHeight: 320,
alignment: AlignmentDirectional.bottomEnd,
child: SingleChildScrollView(
primary: false,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
for (final timeline in widget.timelines)
KeyedSubtree(
key: timeline.id == widget.timelineId
? _selectedMenuItemKey
: null,
child: AppMenuItem(
key: ValueKey('timeline-menu-${timeline.id}'),
label: timeline.name,
selected: timeline.id == widget.timelineId,
selectOption: true,
onPressed: () => _openTimeline(timeline),
),
),
],
),
),
builder: (context, toggle) => IconButton(
key: const Key('timeline-list-button'),
tooltip: context.l10n.timelines,
onPressed: () {
toggle();
_showSelectedMenuItem();
},
padding: EdgeInsets.zero,
style: actionStyle,
constraints: BoxConstraints.tightFor(
width: actionHeight,
height: actionHeight,
),
icon: const Icon(AppIcons.more, size: AppIconSize.small),
),
),
);
return ColoredBox(
color: Theme.of(context).colorScheme.surface,
key: const Key('timeline-tabs-background'),
color: AppTheme.timelineTabsBackground(context),
child: SizedBox(
key: const Key('timeline-tabs-bar'),
height: _barHeight,
child: Row(
children: [
SizedBox.square(
dimension: _barHeight,
child: IconButton(
key: const Key('timeline-add-button'),
tooltip: context.l10n.createTimelineHint,
onPressed: _createTimeline,
padding: EdgeInsets.zero,
constraints: const BoxConstraints.tightFor(
width: _barHeight,
height: _barHeight,
),
icon: const Icon(Icons.add, size: AppIconSize.small),
),
),
if (!desktop) addButton,
Expanded(
child: ScrollEdgeFade(
controller: _scrollController,
axis: Axis.horizontal,
child: Listener(
onPointerSignal: (event) {
if (event is! PointerScrollEvent ||
!_scrollController.hasClients) {
return;
}
final delta = event.scrollDelta.dy != 0
? event.scrollDelta.dy
: event.scrollDelta.dx;
if (delta == 0) return;
final position = _scrollController.position;
_scrollController.jumpTo(
(position.pixels + delta).clamp(
position.minScrollExtent,
position.maxScrollExtent,
),
);
},
child: SingleChildScrollView(
key: const Key('timeline-tabs-list'),
controller: _scrollController,
scrollDirection: Axis.horizontal,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: AppSpacing.tiny,
),
child: desktop
? Align(
alignment: AlignmentDirectional.centerStart,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
for (
var index = 0;
index < widget.timelines.length;
index++
) ...[
if (index > 0)
const SizedBox(width: AppSpacing.hairline),
_buildTab(context, widget.timelines[index]),
],
Flexible(child: tabList),
addButton,
],
),
),
),
),
),
)
: tabList,
),
SizedBox.square(
dimension: _barHeight,
child: AppPopover(
width: _menuWidth,
maxHeight: 320,
alignment: AlignmentDirectional.bottomEnd,
child: SingleChildScrollView(
primary: false,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
for (final timeline in widget.timelines)
KeyedSubtree(
key: timeline.id == widget.timelineId
? _selectedMenuItemKey
: null,
child: AppMenuItem(
key: ValueKey('timeline-menu-${timeline.id}'),
label: timeline.name,
selected: timeline.id == widget.timelineId,
selectOption: true,
onPressed: () => _openTimeline(timeline),
),
),
],
),
),
builder: (context, toggle) => IconButton(
key: const Key('timeline-list-button'),
tooltip: context.l10n.timelines,
onPressed: () {
toggle();
_showSelectedMenuItem();
},
padding: EdgeInsets.zero,
constraints: const BoxConstraints.tightFor(
width: _barHeight,
height: _barHeight,
),
icon: const Icon(Icons.more_horiz, size: AppIconSize.small),
),
Padding(
padding: EdgeInsetsDirectional.only(
end: desktop ? AppSpacing.tiny : 0,
),
child: listButton,
),
],
),
@@ -449,19 +518,19 @@ class _TimelineTabsBarState extends ConsumerState<_TimelineTabsBar> {
label: timeline.pinned
? context.l10n.unpinTimeline
: context.l10n.pinTimeline,
icon: Icons.push_pin_outlined,
icon: AppIcons.pin,
onPressed: () => _setTimelinePinned(timeline),
),
AppMenuItem(
key: ValueKey('timeline-rename-${timeline.id}'),
label: context.l10n.rename,
icon: Icons.drive_file_rename_outline,
icon: AppIcons.rename,
onPressed: () => _renameTimeline(timeline),
),
AppMenuItem(
key: ValueKey('timeline-delete-${timeline.id}'),
label: context.l10n.delete,
icon: Icons.delete_outline,
icon: AppIcons.delete,
destructive: true,
onPressed: widget.timelines.length <= 1
? null
@@ -470,59 +539,33 @@ class _TimelineTabsBarState extends ConsumerState<_TimelineTabsBar> {
],
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 3),
child: TextButton(
key: ValueKey('timeline-tab-${timeline.id}'),
onPressed: () => _openTimeline(timeline),
style: ButtonStyle(
minimumSize: const WidgetStatePropertyAll(Size(0, 20)),
maximumSize: const WidgetStatePropertyAll(
Size(double.infinity, 20),
child: Semantics(
selected: selected,
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: AppTheme.isDesktop(context) ? 180 : double.infinity,
),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
textStyle: WidgetStatePropertyAll(
Theme.of(context).textTheme.labelLarge?.copyWith(
fontSize: 12,
height: 1.3,
fontWeight: FontWeight.w400,
child: TextButton(
key: ValueKey('timeline-tab-${timeline.id}'),
onPressed: () => _openTimeline(timeline),
style: AppTheme.timelineTabStyle(context, selected: selected),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (timeline.pinned) ...[
const Icon(AppIcons.pinFilled, size: 10),
const SizedBox(width: AppSpacing.tiny),
],
Flexible(
child: Text(
timeline.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
),
padding: const WidgetStatePropertyAll(
EdgeInsets.symmetric(horizontal: AppSpacing.small),
),
foregroundColor: WidgetStatePropertyAll(
selected
? Theme.of(context).colorScheme.onSurface
: Theme.of(context).colorScheme.onSurfaceVariant,
),
backgroundColor: WidgetStatePropertyAll(
selected
? Theme.of(context).colorScheme.onSurface
.withValues(alpha: .05)
: Colors.transparent,
),
overlayColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.hovered) ||
states.contains(WidgetState.focused) ||
states.contains(WidgetState.pressed)) {
return Theme.of(context).colorScheme.onSurface
.withValues(alpha: .078);
}
return Colors.transparent;
}),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (timeline.pinned) ...[
const Icon(Icons.push_pin, size: 10),
const SizedBox(width: AppSpacing.tiny),
],
Text(
timeline.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
),
@@ -532,9 +575,16 @@ class _TimelineTabsBarState extends ConsumerState<_TimelineTabsBar> {
}
class _TimelineEditor extends StatefulWidget {
const _TimelineEditor({required this.session, required this.projectId});
const _TimelineEditor({
required this.session,
required this.projectId,
required this.onSelectionActivated,
required this.rulerTimecodeLayout,
});
final String projectId;
final EditorTimelineSession session;
final VoidCallback onSelectionActivated;
final TimelineRulerTimecodeLayout? rulerTimecodeLayout;
@override
State<_TimelineEditor> createState() => _TimelineEditorState();
@@ -545,6 +595,49 @@ class _TimelineEditorState extends State<_TimelineEditor> {
String get projectId => widget.projectId;
RuntimeTimelineThumbnails get _thumbnails => session.thumbnails;
RuntimeTimelineWaveforms get _waveforms => session.waveforms;
TimelineViewController? _selectionView;
Set<Object> _lastSelection = {};
@override
void initState() {
super.initState();
session.addListener(_bindSelectionView);
_bindSelectionView();
}
@override
void didUpdateWidget(covariant _TimelineEditor oldWidget) {
super.didUpdateWidget(oldWidget);
if (!identical(oldWidget.session, session)) {
oldWidget.session.removeListener(_bindSelectionView);
session.addListener(_bindSelectionView);
_bindSelectionView();
}
}
void _bindSelectionView() {
final sequence = session.activeSequenceId;
final next = sequence == null ? null : session.view(sequence);
if (identical(next, _selectionView)) return;
_selectionView?.editingChanges.removeListener(_selectionChanged);
_selectionView = next;
_lastSelection = next?.selectedIdentities.toSet() ?? {};
next?.editingChanges.addListener(_selectionChanged);
}
void _selectionChanged() {
final selected = _selectionView?.selectedIdentities.toSet() ?? {};
if (setEquals(selected, _lastSelection)) return;
_lastSelection = selected;
if (selected.isNotEmpty) widget.onSelectionActivated();
}
@override
void dispose() {
session.removeListener(_bindSelectionView);
_selectionView?.editingChanges.removeListener(_selectionChanged);
super.dispose();
}
@override
Widget build(BuildContext context) => ListenableSelector(
@@ -709,7 +802,9 @@ class _TimelineEditorState extends State<_TimelineEditor> {
}
final controller = session.view(sequenceId);
return WorkspacePanel(
headerHeight: 32,
headerHeight: AppTheme.isDesktop(context)
? AppDesktopMetrics.timelineToolbar
: 32,
headerPadding: EdgeInsets.zero,
controls: ListenableSelector(
listenable: Listenable.merge([
@@ -730,103 +825,191 @@ class _TimelineEditorState extends State<_TimelineEditor> {
builder: (context, _) {
final captionCues = _selectedCaptionCues(controller);
final canSplitCaption = _canSplitCaption(controller, captionCues);
return SizedBox(
key: const Key('timeline-toolbar'),
height: 32,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.gap),
child: LayoutBuilder(
builder: (context, constraints) => SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: ConstrainedBox(
constraints: BoxConstraints(minWidth: constraints.maxWidth),
child: IntrinsicWidth(
child: Row(
children: [
Row(
mainAxisSize: MainAxisSize.min,
spacing: AppSpacing.tiny,
children: [
_toolbarButton(
tooltip: context.l10n.undo,
onPressed: controller.canUndo
? controller.undo
: null,
icon: Icons.undo,
),
_toolbarButton(
tooltip: context.l10n.redo,
onPressed: controller.canRedo
? controller.redo
: null,
icon: Icons.redo,
),
_toolbarButton(
tooltip: context.l10n.splitAtPlayhead,
onPressed: canSplitCaption
? () => _runCaptionEdit(
context,
() => _splitCaption(
sequenceId,
controller,
captionCues.single,
),
)
: controller.canCutSelection
? controller.cutSelectionAtPlayhead
: null,
icon: Icons.content_cut,
),
_toolbarButton(
key: const ValueKey('timeline-trim-left'),
tooltip: context.l10n.trimLeftTooltip,
onPressed: controller.canCutSelection
? controller.trimLeftAtPlayhead
: null,
icon: Icons.align_horizontal_left,
semanticLabel: context.l10n.trimLeft,
),
_toolbarButton(
key: const ValueKey('timeline-trim-right'),
tooltip: context.l10n.trimRightTooltip,
onPressed: controller.canCutSelection
? controller.trimRightAtPlayhead
: null,
icon: Icons.align_horizontal_right,
semanticLabel: context.l10n.trimRight,
),
_toolbarButton(
key: const ValueKey(
'timeline-delete-selection',
if (!AppTheme.isDesktop(context)) {
return SizedBox(
key: const Key('timeline-toolbar'),
height: 32,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.gap),
child: LayoutBuilder(
builder: (context, constraints) => SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: ConstrainedBox(
constraints: BoxConstraints(
minWidth: constraints.maxWidth,
),
child: IntrinsicWidth(
child: Row(
children: [
Row(
mainAxisSize: MainAxisSize.min,
spacing: AppSpacing.tiny,
children: [
_toolbarButton(
tooltip: context.l10n.undo,
onPressed: controller.canUndo
? controller.undo
: null,
icon: AppIcons.undo,
),
tooltip: context.l10n.deleteSelectedClips,
onPressed: () {
if (!controller.canDeleteSelection) return;
controller.deleteSelection();
},
icon: Icons.delete_outline,
),
],
),
const Spacer(),
_toolbarButton(
key: const ValueKey('timeline-fit'),
tooltip: context.l10n.fitTimeline,
semanticLabel: context.l10n.fitTimeline,
onPressed: controller.fitTimeline,
icon: Icons.fit_screen,
),
if (controller.commandRejection != null)
Tooltip(
message: controller.commandRejection!,
child: const Icon(Icons.info_outline),
_toolbarButton(
tooltip: context.l10n.redo,
onPressed: controller.canRedo
? controller.redo
: null,
icon: AppIcons.redo,
),
_toolbarButton(
tooltip: context.l10n.splitAtPlayhead,
onPressed: canSplitCaption
? () => _runCaptionEdit(
context,
() => _splitCaption(
sequenceId,
controller,
captionCues.single,
),
)
: controller.canCutSelection
? controller.cutSelectionAtPlayhead
: null,
icon: AppIcons.cut,
),
_toolbarButton(
key: const ValueKey('timeline-trim-left'),
tooltip: context.l10n.trimLeftTooltip,
onPressed: controller.canCutSelection
? controller.trimLeftAtPlayhead
: null,
icon: AppIcons.alignLeft,
semanticLabel: context.l10n.trimLeft,
),
_toolbarButton(
key: const ValueKey('timeline-trim-right'),
tooltip: context.l10n.trimRightTooltip,
onPressed: controller.canCutSelection
? controller.trimRightAtPlayhead
: null,
icon: AppIcons.alignRight,
semanticLabel: context.l10n.trimRight,
),
_toolbarButton(
key: const ValueKey(
'timeline-delete-selection',
),
tooltip: context.l10n.deleteSelectedClips,
onPressed: () {
if (!controller.canDeleteSelection) return;
controller.deleteSelection();
},
icon: AppIcons.delete,
),
],
),
],
const Spacer(),
_toolbarButton(
key: const ValueKey('timeline-fit'),
tooltip: context.l10n.fitTimeline,
semanticLabel: context.l10n.fitTimeline,
onPressed: controller.fitTimeline,
icon: AppIcons.fitContent,
),
if (controller.commandRejection != null)
Tooltip(
message: controller.commandRejection!,
child: const Icon(AppIcons.info),
),
],
),
),
),
),
),
),
);
}
return SizedBox(
key: const Key('timeline-toolbar'),
height: AppTheme.isDesktop(context)
? AppDesktopMetrics.timelineToolbar
: 32,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: AppCommandToolbar(
groups: [
[
AppToolbarCommand(
label: context.l10n.undo,
onPressed: controller.canUndo ? controller.undo : null,
icon: AppIcons.undo,
),
AppToolbarCommand(
label: context.l10n.redo,
onPressed: controller.canRedo ? controller.redo : null,
icon: AppIcons.redo,
),
],
[
AppToolbarCommand(
label: context.l10n.splitAtPlayhead,
onPressed: canSplitCaption
? () => _runCaptionEdit(
context,
() => _splitCaption(
sequenceId,
controller,
captionCues.single,
),
)
: controller.canCutSelection
? controller.cutSelectionAtPlayhead
: null,
icon: AppIcons.cut,
),
AppToolbarCommand(
key: const ValueKey('timeline-trim-left'),
label: context.l10n.trimLeftTooltip,
semanticLabel: context.l10n.trimLeft,
onPressed: controller.canCutSelection
? controller.trimLeftAtPlayhead
: null,
icon: AppIcons.alignLeft,
),
AppToolbarCommand(
key: const ValueKey('timeline-trim-right'),
label: context.l10n.trimRightTooltip,
semanticLabel: context.l10n.trimRight,
onPressed: controller.canCutSelection
? controller.trimRightAtPlayhead
: null,
icon: AppIcons.alignRight,
),
AppToolbarCommand(
key: const ValueKey('timeline-delete-selection'),
label: context.l10n.deleteSelectedClips,
onPressed: controller.canDeleteSelection
? controller.deleteSelection
: null,
icon: AppIcons.delete,
),
],
],
trailing: [
AppToolbarCommand(
key: const ValueKey('timeline-fit'),
label: context.l10n.fitTimeline,
semanticLabel: context.l10n.fitTimeline,
onPressed: controller.fitTimeline,
icon: AppIcons.fitContent,
),
],
status: controller.commandRejection == null
? null
: Tooltip(
message: controller.commandRejection!,
child: const Icon(AppIcons.info, size: 16),
),
),
),
);
},
@@ -863,9 +1046,7 @@ class _TimelineEditorState extends State<_TimelineEditor> {
label: restoreAudio
? context.l10n.restoreAudio
: context.l10n.detachAudio,
icon: restoreAudio
? Icons.volume_up_outlined
: Icons.audio_file_outlined,
icon: restoreAudio ? AppIcons.volume : AppIcons.audioFile,
onPressed:
session.acceptsEdits &&
detachTarget != null &&
@@ -895,12 +1076,12 @@ class _TimelineEditorState extends State<_TimelineEditor> {
),
AppMenuItem(
label: context.l10n.separateVocals,
icon: Icons.graphic_eq,
icon: AppIcons.audioWaveform,
onPressed: null,
),
AppMenuItem(
label: context.l10n.removeBackground,
icon: Icons.person_remove_outlined,
icon: AppIcons.removeBackground,
onPressed: backgroundRemovalTarget == null
? null
: () => showAppDialog<void>(
@@ -913,7 +1094,7 @@ class _TimelineEditorState extends State<_TimelineEditor> {
),
AppMenuItem(
label: context.l10n.generateCaptions,
icon: Icons.subtitles_outlined,
icon: AppIcons.subtitles,
onPressed: target == null
? null
: () => showAppDialog<void>(
@@ -926,7 +1107,7 @@ class _TimelineEditorState extends State<_TimelineEditor> {
),
AppMenuItem(
label: context.l10n.deleteSelectedClips,
icon: Icons.delete_outline,
icon: AppIcons.delete,
destructive: true,
onPressed: controller.canDeleteSelection
? controller.deleteSelection
@@ -941,9 +1122,10 @@ class _TimelineEditorState extends State<_TimelineEditor> {
Expanded(
child: Directionality(
textDirection: TextDirection.ltr,
child: TimelineViewport(
child: EditorTimelineViewport(
leadingPadding: AppSpacing.medium,
controller: controller,
rulerTimecodeLayout: widget.rulerTimecodeLayout,
child: TimelineAssetDropTarget(
projectId: projectId,
session: session,
@@ -975,8 +1157,15 @@ class _TimelineEditorState extends State<_TimelineEditor> {
controller: controller,
),
),
ListenableBuilder(
ListenableSelector<Object>(
listenable: controller.contentChanges,
select: () => (
controller.contentEndTick == 0,
controller.isDragging,
controller.geometry.primaryTop,
controller.geometry.primaryHeight,
controller.camera.verticalOffset,
),
builder: (context, _) =>
controller.contentEndTick == 0 &&
!controller.isDragging