feat(workspace): refresh desktop editing experience and prepare 0.1.2
Gitea CI / Build Android APK (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 0s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Check code and tests (pull_request) Canceled after 6m29s
Gitea CI / Build Android APK (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 0s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Check code and tests (pull_request) Canceled after 6m29s
This commit is contained in:
1 parent
aa5255d1e4
commit
2e0033ce2d
260 files changed
+43963
-5591
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import '../../shared/widgets/listenable_selector.dart';
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
@@ -11,9 +13,12 @@ import 'package:cutdex_native/cutdex_native.dart';
|
||||
import '../../persistence/app_settings_repositories.dart';
|
||||
import '../../shared/layout/workspace_layout_metrics.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
|
||||
import '../../workspace/timeline_provider.dart';
|
||||
import '../../workspace/preview_target.dart';
|
||||
import '../../workspace/projects.dart';
|
||||
import '../../workspace/view_settings.dart';
|
||||
import '../media/media_browser_page.dart';
|
||||
import '../media/media_panel.dart';
|
||||
@@ -23,6 +28,7 @@ import '../properties/properties_panel.dart';
|
||||
import '../timeline/timeline_panel.dart';
|
||||
import 'editor_presentation_controller.dart';
|
||||
import 'editor_panel_defaults.dart';
|
||||
import 'timeline_operation_region.dart';
|
||||
import 'layouts/bounded_editor_layout.dart';
|
||||
import 'layouts/expanded_editor_layout.dart';
|
||||
|
||||
@@ -42,6 +48,8 @@ class EditorWorkspace extends ConsumerStatefulWidget {
|
||||
});
|
||||
|
||||
final bool projectLoading;
|
||||
|
||||
/// Navigation is preparing another timeline; the current content stays visible.
|
||||
final bool timelineLoading;
|
||||
final String projectId;
|
||||
final String timelineId;
|
||||
@@ -57,7 +65,13 @@ class EditorWorkspace extends ConsumerStatefulWidget {
|
||||
|
||||
class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
final _previewKey = GlobalKey();
|
||||
bool get _timelinePending => widget.projectLoading || widget.timelineLoading;
|
||||
bool get _timelinePending => widget.projectLoading;
|
||||
|
||||
Widget _timelineInteraction(Widget child) => TimelineOperationRegion(
|
||||
projectId: widget.projectId,
|
||||
loading: widget.timelineLoading,
|
||||
child: child,
|
||||
);
|
||||
EditorPresentationController get _presentation =>
|
||||
ref.read(editorPresentationProvider(widget.projectId));
|
||||
ProjectViewSettingsData get _viewSettings =>
|
||||
@@ -69,7 +83,8 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
double? get _timelineHeight => _viewSettings.timelineHeight;
|
||||
|
||||
void _saveViewSettings() {
|
||||
if (!ref.read(projectViewSettingsProvider(widget.projectId)).hasValue) {
|
||||
if (widget.projectId.isEmpty ||
|
||||
!ref.read(projectViewSettingsProvider(widget.projectId)).hasValue) {
|
||||
return;
|
||||
}
|
||||
unawaited(_viewController.save());
|
||||
@@ -82,10 +97,12 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
);
|
||||
final preview = KeyedSubtree(
|
||||
key: _previewKey,
|
||||
child: EditorPreviewPanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
pending: _timelinePending,
|
||||
child: _timelineInteraction(
|
||||
EditorPreviewPanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
pending: _timelinePending,
|
||||
),
|
||||
),
|
||||
);
|
||||
final timeline = EditorTimelinePanel(
|
||||
@@ -94,35 +111,81 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
pending: widget.projectLoading,
|
||||
timelineLoading: widget.timelineLoading,
|
||||
);
|
||||
final properties = _timelinePending
|
||||
? const EditorEmptyPanel()
|
||||
: EditorPropertiesPanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
);
|
||||
final properties = _timelineInteraction(
|
||||
_timelinePending
|
||||
? const EditorEmptyPanel()
|
||||
: EditorPropertiesPanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
),
|
||||
);
|
||||
final media = widget.projectLoading
|
||||
? const EditorEmptyPanel()
|
||||
: MediaPanel(projectId: widget.projectId);
|
||||
: MediaPanel(projectId: widget.projectId, projectScoped: true);
|
||||
return ListenableBuilder(
|
||||
listenable: ref.watch(editorPresentationProvider(widget.projectId)),
|
||||
builder: (context, _) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final desktop = widget.experience == DeviceExperience.desktop;
|
||||
final mediaOpen = desktop
|
||||
? _presentation.mediaOpen
|
||||
: _presentation.activeTool == EditorTool.media;
|
||||
final mediaWidth = mediaOpen
|
||||
? WorkspaceLayoutMetrics.mediaPanelWidth +
|
||||
WorkspaceLayoutMetrics.desktopSpacing
|
||||
: 0.0;
|
||||
final sideWidth = (_propertiesOpen
|
||||
? WorkspaceLayoutMetrics.propertiesPanelWidth + 1
|
||||
? WorkspaceLayoutMetrics.propertiesPanelWidth +
|
||||
WorkspaceLayoutMetrics.desktopSpacing
|
||||
: 0);
|
||||
final dockPanels =
|
||||
final dockMedia =
|
||||
desktop &&
|
||||
mediaOpen &&
|
||||
constraints.maxWidth >=
|
||||
WorkspaceLayoutMetrics.previewMinimumWidth + sideWidth;
|
||||
final desktopTool = _propertiesOpen ? EditorTool.properties : null;
|
||||
final headerHeight = desktop ? AppControlSize.panelToolbar : 48.0;
|
||||
final mediaOpen = _presentation.activeTool == EditorTool.media;
|
||||
WorkspaceLayoutMetrics.previewMinimumWidth + mediaWidth;
|
||||
final dockProperties =
|
||||
desktop &&
|
||||
_propertiesOpen &&
|
||||
constraints.maxWidth >=
|
||||
WorkspaceLayoutMetrics.previewMinimumWidth +
|
||||
sideWidth +
|
||||
(dockMedia ? mediaWidth : 0);
|
||||
final desktopTool =
|
||||
mediaOpen && !dockMedia && _presentation.desktopToolRequested
|
||||
? _presentation.desktopTool(propertiesOpen: _propertiesOpen)
|
||||
: _propertiesOpen && !dockProperties
|
||||
? EditorTool.properties
|
||||
: null;
|
||||
final headerHeight = desktop ? AppDesktopMetrics.panelHeader : 48.0;
|
||||
final propertiesOpen = desktop
|
||||
? dockPanels
|
||||
? dockProperties
|
||||
? _propertiesOpen
|
||||
: desktopTool == EditorTool.properties
|
||||
: _presentation.activeTool == EditorTool.properties;
|
||||
final mediaButton = HeaderControlRegion(
|
||||
child: SizedBox.square(
|
||||
dimension: desktop ? AppControlSize.headerButton : 48,
|
||||
child: IconButton(
|
||||
key: const Key('editor-media-button'),
|
||||
tooltip: context.l10n.materials,
|
||||
isSelected: mediaOpen,
|
||||
onPressed: () {
|
||||
if (desktop) {
|
||||
if (!dockMedia &&
|
||||
desktopTool != EditorTool.media &&
|
||||
_presentation.mediaOpen) {
|
||||
_presentation.preferDesktopTool(EditorTool.media);
|
||||
} else {
|
||||
_presentation.toggleMedia();
|
||||
}
|
||||
} else {
|
||||
_presentation.toggleTool(EditorTool.media);
|
||||
}
|
||||
},
|
||||
icon: const Icon(AppIcons.mediaLibrary),
|
||||
),
|
||||
),
|
||||
);
|
||||
final header = Material(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: SizedBox(
|
||||
@@ -132,15 +195,22 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
padding: desktop
|
||||
? const EdgeInsets.symmetric(
|
||||
horizontal: AppSidebarMetrics.outerPadding,
|
||||
vertical: AppSpacing.gap,
|
||||
vertical: AppSpacing.tiny,
|
||||
)
|
||||
: EdgeInsets.zero,
|
||||
child: WindowHeaderPadding(
|
||||
child: Row(
|
||||
children: [
|
||||
widget.headerLeading,
|
||||
if (desktop) mediaButton,
|
||||
Expanded(
|
||||
child: widget.showProjectName
|
||||
child: desktop
|
||||
? _PreviewHeaderTitle(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
pending: _timelinePending,
|
||||
)
|
||||
: widget.showProjectName
|
||||
? Row(
|
||||
children: [
|
||||
Flexible(
|
||||
@@ -168,35 +238,7 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
if (!desktop)
|
||||
HeaderControlRegion(
|
||||
child: SizedBox.square(
|
||||
dimension: desktop
|
||||
? AppControlSize.headerButton
|
||||
: 48,
|
||||
child: IconButton(
|
||||
key: const Key('editor-media-button'),
|
||||
tooltip: context.l10n.materials,
|
||||
isSelected: mediaOpen,
|
||||
onPressed: () {
|
||||
if (desktop) {
|
||||
if (!dockPanels &&
|
||||
desktopTool != EditorTool.media &&
|
||||
_presentation.mediaOpen) {
|
||||
_presentation.preferDesktopTool(
|
||||
EditorTool.media,
|
||||
);
|
||||
} else {
|
||||
_presentation.toggleMedia();
|
||||
}
|
||||
} else {
|
||||
_presentation.toggleTool(EditorTool.media);
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.perm_media_outlined),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!desktop) mediaButton,
|
||||
if (!desktop) const SizedBox(width: AppSpacing.tiny),
|
||||
HeaderControlRegion(
|
||||
child: SizedBox.square(
|
||||
@@ -211,7 +253,7 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
? null
|
||||
: () {
|
||||
if (desktop) {
|
||||
if (dockPanels ||
|
||||
if (dockProperties ||
|
||||
desktopTool ==
|
||||
EditorTool.properties ||
|
||||
!_propertiesOpen) {
|
||||
@@ -230,7 +272,7 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.tune,
|
||||
AppIcons.tune,
|
||||
size: AppIconSize.header,
|
||||
),
|
||||
),
|
||||
@@ -249,8 +291,8 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
header: header,
|
||||
properties: properties,
|
||||
media: media,
|
||||
showMedia: false,
|
||||
showProperties: showTools && _propertiesOpen,
|
||||
showMedia: dockMedia,
|
||||
showProperties: showTools && dockProperties,
|
||||
timelineHeight: _timelineHeight,
|
||||
onTimelineHeightChanged: (height) {
|
||||
if (viewSettings.hasValue) {
|
||||
@@ -267,7 +309,7 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
children: [
|
||||
if (!desktop) header,
|
||||
Expanded(
|
||||
child: dockPanels
|
||||
child: desktop && desktopTool == null
|
||||
? dockedEditing(showTools: true)
|
||||
: BoundedEditorLayout(
|
||||
experience: widget.experience,
|
||||
@@ -297,14 +339,18 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
: switch (widget.experience) {
|
||||
DeviceExperience.desktop => properties,
|
||||
DeviceExperience.tablet =>
|
||||
PropertiesToolPanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
_timelineInteraction(
|
||||
PropertiesToolPanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
),
|
||||
),
|
||||
DeviceExperience.phone =>
|
||||
PropertiesEditorPage(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
_timelineInteraction(
|
||||
PropertiesEditorPage(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
),
|
||||
),
|
||||
},
|
||||
onCloseTool: () {
|
||||
@@ -338,6 +384,73 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
}
|
||||
}
|
||||
|
||||
class _PreviewHeaderTitle extends ConsumerWidget {
|
||||
const _PreviewHeaderTitle({
|
||||
required this.projectId,
|
||||
required this.timelineId,
|
||||
required this.pending,
|
||||
});
|
||||
|
||||
final String projectId;
|
||||
final String timelineId;
|
||||
final bool pending;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final navigation = pending
|
||||
? const PreviewTargetState.timeline()
|
||||
: ref.watch(previewNavigationProvider(projectId, timelineId));
|
||||
final name = pending
|
||||
? context.l10n.preview
|
||||
: ref.watch(
|
||||
projectsProvider.select((value) {
|
||||
final workspace = value.value;
|
||||
return switch (navigation) {
|
||||
SourcePreviewTarget(:final asset) =>
|
||||
workspace?.assets
|
||||
.where((item) => item.id == asset.id)
|
||||
.firstOrNull
|
||||
?.name ??
|
||||
asset.name,
|
||||
_ =>
|
||||
workspace?.timeline?.id == timelineId
|
||||
? workspace!.timeline!.name
|
||||
: context.l10n.preview,
|
||||
};
|
||||
}),
|
||||
);
|
||||
final session = pending
|
||||
? null
|
||||
: ref.watch(editorTimelineProvider(projectId, timelineId)).value;
|
||||
Widget title(String? saveStatus) => Tooltip(
|
||||
message: saveStatus == null ? name : '$name\n$saveStatus',
|
||||
child: Text(
|
||||
name,
|
||||
key: const Key('editor-preview-title'),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
);
|
||||
if (session == null) return title(null);
|
||||
return ListenableSelector<(bool, bool, bool)>(
|
||||
listenable: session,
|
||||
select: () => (session.error != null, session.saving, session.dirty),
|
||||
builder: (context, value) => title(_timelineSaveLabel(context, value)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String _timelineSaveLabel(BuildContext context, (bool, bool, bool) value) =>
|
||||
value.$1
|
||||
? context.l10n.unsaved
|
||||
: value.$2
|
||||
? context.l10n.saving
|
||||
: value.$3
|
||||
? context.l10n.pendingSave
|
||||
: context.l10n.saved;
|
||||
|
||||
class _TimelineSaveStatus extends ConsumerWidget {
|
||||
const _TimelineSaveStatus({
|
||||
required this.projectId,
|
||||
@@ -354,22 +467,19 @@ class _TimelineSaveStatus extends ConsumerWidget {
|
||||
.asData
|
||||
?.value;
|
||||
if (session == null) return const SizedBox.shrink();
|
||||
return ListenableBuilder(
|
||||
return ListenableSelector<(bool, bool, bool)>(
|
||||
listenable: session,
|
||||
builder: (context, _) => Padding(
|
||||
select: () => (session.error != null, session.saving, session.dirty),
|
||||
builder: (context, value) => Padding(
|
||||
padding: const EdgeInsets.only(left: AppSpacing.small),
|
||||
child: Text(
|
||||
session.error != null
|
||||
? context.l10n.unsaved
|
||||
: session.saving
|
||||
? context.l10n.saving
|
||||
: session.dirty
|
||||
? context.l10n.pendingSave
|
||||
: context.l10n.saved,
|
||||
_timelineSaveLabel(context, value),
|
||||
key: const Key('timeline-save-status'),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(fontSize: 10),
|
||||
style: AppTheme.isDesktop(context)
|
||||
? Theme.of(context).textTheme.bodySmall
|
||||
: Theme.of(context).textTheme.bodySmall?.copyWith(fontSize: 10),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user