feat(workspace): add workflow navigation and resizable desktop panels
This commit is contained in:
1 parent
02413383d8
commit
1acfe4a005
17 files changed
+2008
-277
No files matched your search
@@ -45,6 +45,7 @@ import 'project_switch_region.dart';
|
||||
import 'project_sidebar.dart';
|
||||
import 'project_tabs_bar.dart';
|
||||
import 'project_tabs_controller.dart';
|
||||
import 'workflow_page.dart';
|
||||
import 'widgets/name_dialog.dart';
|
||||
|
||||
/// The single application surface: project navigation beside the editor.
|
||||
@@ -294,6 +295,19 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
);
|
||||
final projects = ref.read(projectsProvider);
|
||||
final state = projects.value ?? const ProjectState();
|
||||
final editorProjectId = state.timeline == null
|
||||
? null
|
||||
: state.activeProject?.id;
|
||||
final editorViewSettings = desktop && editorProjectId != null
|
||||
? ref.watch(
|
||||
projectViewSettingsProvider(editorProjectId).select(
|
||||
(value) => (
|
||||
ready: value.hasValue,
|
||||
timelineHeight: value.value?.timelineHeight,
|
||||
),
|
||||
),
|
||||
)
|
||||
: null;
|
||||
return EditorWindowChrome(
|
||||
headerHeight: desktop ? DesktopWindowFrame.headerHeight : 48,
|
||||
builder: (context, integrated) => Scaffold(
|
||||
@@ -631,30 +645,33 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
),
|
||||
),
|
||||
);
|
||||
bool isActiveContent(DesktopContent surface) =>
|
||||
surface == DesktopContent.workspace
|
||||
? contentSelection.surface ==
|
||||
DesktopContent.workspace ||
|
||||
contentSelection.surface ==
|
||||
DesktopContent.library ||
|
||||
contentSelection.surface ==
|
||||
DesktopContent.resourceLibrary
|
||||
: contentSelection.surface == surface;
|
||||
Widget contentSurface(
|
||||
DesktopContent surface,
|
||||
Widget child,
|
||||
) => ExcludeFocus(
|
||||
excluding:
|
||||
(contentSelection.surface ==
|
||||
DesktopContent.settings) !=
|
||||
(surface == DesktopContent.settings),
|
||||
excluding: !isActiveContent(surface),
|
||||
child: TickerMode(
|
||||
enabled:
|
||||
(contentSelection.surface ==
|
||||
DesktopContent.settings) ==
|
||||
(surface == DesktopContent.settings),
|
||||
enabled: isActiveContent(surface),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
Widget desktopContents(
|
||||
Widget workspace,
|
||||
) => IndexedStack(
|
||||
index:
|
||||
contentSelection.surface ==
|
||||
DesktopContent.settings
|
||||
? 1
|
||||
: 0,
|
||||
index: switch (contentSelection.surface) {
|
||||
DesktopContent.settings => 1,
|
||||
DesktopContent.workflow => 2,
|
||||
_ => 0,
|
||||
},
|
||||
children: [
|
||||
contentSurface(
|
||||
DesktopContent.workspace,
|
||||
@@ -685,6 +702,10 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
contentSurface(
|
||||
DesktopContent.workflow,
|
||||
const WorkflowPage(),
|
||||
),
|
||||
],
|
||||
);
|
||||
return switch (experience) {
|
||||
@@ -773,17 +794,23 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
resourceLibrarySelected:
|
||||
contentSelection.surface ==
|
||||
DesktopContent.resourceLibrary,
|
||||
onResourceLibraryPressed: () => selectSidebar(
|
||||
DesktopContent.resourceLibrary,
|
||||
),
|
||||
settingsSelected:
|
||||
contentSelection.surface ==
|
||||
DesktopContent.settings,
|
||||
onHomePressed: () =>
|
||||
selectSidebar(DesktopContent.workspace),
|
||||
workflowSelected:
|
||||
contentSelection.surface ==
|
||||
DesktopContent.workflow,
|
||||
onHomePressed: () {
|
||||
selectSidebar(DesktopContent.workspace);
|
||||
_setMode(WorkspaceMode.agent);
|
||||
},
|
||||
onWorkflowPressed: () {
|
||||
ref
|
||||
.read(desktopContentProvider.notifier)
|
||||
.select(DesktopContent.workflow);
|
||||
_desktopScaffoldKey.currentState
|
||||
?.closeDrawer();
|
||||
},
|
||||
onSettingsPressed: () =>
|
||||
showSettingsPage(context),
|
||||
child: desktopContents(
|
||||
@@ -794,15 +821,43 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
navigationDrawer: navigation(drawer: true),
|
||||
mode: _mode,
|
||||
sidebarCollapsed: navigationCollapsed,
|
||||
sidebarCanExpand: !navigationHiddenBySpace,
|
||||
sidebarWidth: _sidebarWidthOverride,
|
||||
timelineHeight:
|
||||
editorViewSettings?.timelineHeight,
|
||||
onTimelineHeightChanged:
|
||||
editorViewSettings?.ready == true &&
|
||||
!_switchingProject
|
||||
? (height) => ref
|
||||
.read(
|
||||
projectViewSettingsProvider(
|
||||
editorProjectId!,
|
||||
).notifier,
|
||||
)
|
||||
.setTimelineHeight(height)
|
||||
: null,
|
||||
onJunctionResizeEnd: () {
|
||||
_saveViewState();
|
||||
if (editorViewSettings?.ready == true) {
|
||||
unawaited(
|
||||
ref
|
||||
.read(
|
||||
projectViewSettingsProvider(
|
||||
editorProjectId!,
|
||||
).notifier,
|
||||
)
|
||||
.save(),
|
||||
);
|
||||
}
|
||||
},
|
||||
onSidebarCollapsedChanged: (value) {
|
||||
_sidebarCollapsed = value;
|
||||
_saveViewState();
|
||||
},
|
||||
onSidebarWidthChanged: (value) {
|
||||
_sidebarWidthOverride = value;
|
||||
_saveViewState();
|
||||
},
|
||||
onSidebarResizeEnd: _saveViewState,
|
||||
sidebarBuilder: (geometry, expand) =>
|
||||
navigation(
|
||||
geometry: geometry,
|
||||
|
||||
Reference in new issue
Block a user