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,6 @@
|
||||
import '../../shared/widgets/presentation_list.dart';
|
||||
import '../assistant/agent_panel_presentation.dart';
|
||||
|
||||
import 'package:cutdex/shared/widgets/error_notification_host.dart';
|
||||
import 'package:cutdex/errors/app_failure.dart';
|
||||
|
||||
@@ -23,6 +26,8 @@ import 'package:cutdex_native/cutdex_native.dart';
|
||||
|
||||
import '../../persistence/app_settings_repositories.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
|
||||
import '../../workspace/project_state.dart';
|
||||
@@ -38,6 +43,8 @@ import '../settings/settings_page.dart';
|
||||
import 'editor_loading_region.dart';
|
||||
import 'project_switch_region.dart';
|
||||
import 'project_sidebar.dart';
|
||||
import 'project_tabs_bar.dart';
|
||||
import 'project_tabs_controller.dart';
|
||||
import 'widgets/name_dialog.dart';
|
||||
|
||||
/// The single application surface: project navigation beside the editor.
|
||||
@@ -90,13 +97,26 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
WidgetRef ref, {
|
||||
required bool create,
|
||||
}) async {
|
||||
if (ref.read(projectsProvider).value?.projectBusy == true) return;
|
||||
if (_switchingProject ||
|
||||
ref.read(projectsProvider).value?.projectBusy == true) {
|
||||
return;
|
||||
}
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
try {
|
||||
if (create) {
|
||||
final name = await askName(
|
||||
context,
|
||||
title: context.l10n.newProject,
|
||||
label: context.l10n.projectName,
|
||||
validateName: (name) async {
|
||||
final failure = await ref
|
||||
.read(projectsProvider.notifier)
|
||||
.validateNewProjectName(name);
|
||||
if (!context.mounted) return null;
|
||||
return failure == null
|
||||
? null
|
||||
: context.l10n.failureMessage(failure);
|
||||
},
|
||||
);
|
||||
if (name == null || !context.mounted) return;
|
||||
final created = await ref
|
||||
@@ -130,15 +150,50 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _openProject(WidgetRef ref, RecentProject project) =>
|
||||
ref.read(workspaceNavigationProvider.notifier).openProject(project);
|
||||
Future<void> _openProject(WidgetRef ref, RecentProject project) {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
return ref.read(workspaceNavigationProvider.notifier).openProject(project);
|
||||
}
|
||||
|
||||
Future<void> _closeProjectTab(RecentProject project) async {
|
||||
if (_switchingProject ||
|
||||
ref.read(projectsProvider).value?.projectBusy == true) {
|
||||
return;
|
||||
}
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
final tabs = ref.read(projectTabsProvider);
|
||||
if (ref.read(projectsProvider).value?.activeProject?.id == project.id) {
|
||||
final index = tabs.indexWhere((tab) => tab.id == project.id);
|
||||
final neighbors = [
|
||||
...tabs.skip(index + 1),
|
||||
...tabs.take(index).toList().reversed,
|
||||
];
|
||||
final next = neighbors.firstOrNull;
|
||||
if (next != null) {
|
||||
await _openProject(ref, next);
|
||||
if (!mounted ||
|
||||
ref.read(projectsProvider).value?.activeProject?.id != next.id) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
final closed = await ref
|
||||
.read(projectsProvider.notifier)
|
||||
.closeActiveProject();
|
||||
if (!closed || !mounted) return;
|
||||
}
|
||||
}
|
||||
if (mounted) ref.read(projectTabsProvider.notifier).remove(project.id);
|
||||
}
|
||||
|
||||
Future<bool> _renameProject(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
RecentProject project,
|
||||
) async {
|
||||
if (ref.read(projectsProvider).value?.projectBusy == true) return false;
|
||||
if (_switchingProject ||
|
||||
ref.read(projectsProvider).value?.projectBusy == true) {
|
||||
return false;
|
||||
}
|
||||
final name = await askName(
|
||||
context,
|
||||
title: context.l10n.rename,
|
||||
@@ -147,7 +202,35 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
submitLabel: context.l10n.rename,
|
||||
);
|
||||
if (name == null || !context.mounted || name == project.name) return false;
|
||||
return ref.read(projectsProvider.notifier).renameProject(project, name);
|
||||
final renamed = await ref
|
||||
.read(projectsProvider.notifier)
|
||||
.renameProject(project, name);
|
||||
if (renamed && mounted) {
|
||||
ref
|
||||
.read(projectTabsProvider.notifier)
|
||||
.updateProject(project.copyWith(name: name.trim()));
|
||||
}
|
||||
return renamed;
|
||||
}
|
||||
|
||||
Future<void> _removeRecentProject(RecentProject project) async {
|
||||
if (_switchingProject ||
|
||||
ref.read(projectsProvider).value?.projectBusy == true) {
|
||||
return;
|
||||
}
|
||||
final recent = ref.read(projectsProvider).value?.recent ?? const [];
|
||||
final index = recent.indexWhere((item) => item.id == project.id);
|
||||
final removed = await ref
|
||||
.read(projectsProvider.notifier)
|
||||
.removeRecentProject(project.id);
|
||||
if (!removed || !mounted) return;
|
||||
ErrorNotificationHost.of(context).showMessage(
|
||||
content: Text(context.l10n.projectRemoved),
|
||||
actionLabel: context.l10n.undo,
|
||||
onAction: () => ref
|
||||
.read(projectsProvider.notifier)
|
||||
.restoreRecentProject(project, index),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _relocateProject(
|
||||
@@ -155,7 +238,10 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
WidgetRef ref,
|
||||
RecentProject project,
|
||||
) async {
|
||||
if (ref.read(projectsProvider).value?.projectBusy == true) return;
|
||||
if (_switchingProject ||
|
||||
ref.read(projectsProvider).value?.projectBusy == true) {
|
||||
return;
|
||||
}
|
||||
final directory = await ref
|
||||
.read(filePickerProvider)
|
||||
.pickDirectory(confirmButtonText: context.l10n.openProject);
|
||||
@@ -183,7 +269,30 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
final experience = ref.watch(deviceExperienceProvider);
|
||||
final desktop = experience == DeviceExperience.desktop;
|
||||
final contentSelection = ref.watch(desktopContentProvider);
|
||||
final projects = ref.watch(projectsProvider);
|
||||
final openProjects = ref.watch(projectTabsProvider);
|
||||
// Window/navigation subscribe to chrome only. Content owns live values.
|
||||
ref.watch(
|
||||
projectsProvider.select((value) {
|
||||
final state = value.value;
|
||||
return (
|
||||
value.isLoading,
|
||||
value.error,
|
||||
state?.activeProject,
|
||||
PresentationList(state?.recent ?? const <RecentProject>[]),
|
||||
state?.timeline?.id,
|
||||
state?.projectBusy,
|
||||
state?.openingTimelineId,
|
||||
state?.error,
|
||||
PresentationList(
|
||||
state?.timelines.map(
|
||||
(timeline) => (timeline.id, timeline.name, timeline.pinned),
|
||||
) ??
|
||||
const <(String, String, bool)>[],
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
final projects = ref.read(projectsProvider);
|
||||
final state = projects.value ?? const ProjectState();
|
||||
return EditorWindowChrome(
|
||||
headerHeight: desktop ? DesktopWindowFrame.headerHeight : 48,
|
||||
@@ -210,6 +319,42 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
);
|
||||
final navigationCollapsed =
|
||||
_sidebarCollapsed || navigationHiddenBySpace;
|
||||
void toggleSidebar() {
|
||||
if (desktop && _desktopSplits.agentFloating) {
|
||||
_desktopSplits.setAgentFloating(false);
|
||||
_sidebarCollapsed = false;
|
||||
_saveViewState();
|
||||
if (navigationHiddenBySpace) {
|
||||
_desktopScaffoldKey.currentState
|
||||
?.openDrawer();
|
||||
}
|
||||
} else if (navigationHiddenBySpace) {
|
||||
final scaffold =
|
||||
_desktopScaffoldKey.currentState;
|
||||
if (scaffold?.isDrawerOpen == true) {
|
||||
scaffold?.closeDrawer();
|
||||
} else {
|
||||
scaffold?.openDrawer();
|
||||
}
|
||||
} else {
|
||||
_sidebarCollapsed = !_sidebarCollapsed;
|
||||
_saveViewState();
|
||||
}
|
||||
}
|
||||
|
||||
void toggleAgentFloating() {
|
||||
final floating = !_desktopSplits.agentFloating;
|
||||
if (floating) {
|
||||
_desktopScaffoldKey.currentState?.closeDrawer();
|
||||
_sidebarCollapsed = false;
|
||||
_saveViewState();
|
||||
}
|
||||
_desktopSplits.setAgentFloating(floating);
|
||||
if (!floating && navigationHiddenBySpace) {
|
||||
_desktopScaffoldKey.currentState?.openDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
Widget controlSlot(Widget child) {
|
||||
if (!desktop) {
|
||||
return SizedBox.square(
|
||||
@@ -263,9 +408,7 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: desktop
|
||||
? (DesktopWindowFrame.railWidth -
|
||||
AppControlSize.headerButton) /
|
||||
2
|
||||
? DesktopWindowFrame.headerInset
|
||||
: 0,
|
||||
),
|
||||
child: Row(
|
||||
@@ -281,21 +424,12 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
tooltip: navigationCollapsed
|
||||
? context.l10n.expandSidebar
|
||||
: context.l10n.collapseSidebar,
|
||||
onPressed: () {
|
||||
if (navigationHiddenBySpace) {
|
||||
_desktopScaffoldKey.currentState
|
||||
?.openDrawer();
|
||||
} else {
|
||||
_sidebarCollapsed =
|
||||
!_sidebarCollapsed;
|
||||
_saveViewState();
|
||||
}
|
||||
},
|
||||
onPressed: toggleSidebar,
|
||||
style: sidebarActionButtonStyle(
|
||||
context,
|
||||
),
|
||||
icon: const Icon(
|
||||
Icons.view_sidebar_outlined,
|
||||
AppIcons.sidebar,
|
||||
size: AppIconSize.header,
|
||||
),
|
||||
),
|
||||
@@ -316,7 +450,7 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
context,
|
||||
),
|
||||
icon: const Icon(
|
||||
Icons.settings_outlined,
|
||||
AppIcons.settings,
|
||||
size: AppIconSize.header,
|
||||
),
|
||||
),
|
||||
@@ -349,6 +483,7 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
|
||||
final agent = WorkspaceAgentSurface(
|
||||
key: _agentKey,
|
||||
showProjectSelector: !desktop,
|
||||
state: state,
|
||||
onSelectProject: (project) =>
|
||||
project.availability.canOpen
|
||||
@@ -357,14 +492,10 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
onCreateProject: () =>
|
||||
_selectProject(context, ref, create: true),
|
||||
);
|
||||
void selectSidebar(bool resources) {
|
||||
void selectSidebar(DesktopContent surface) {
|
||||
ref
|
||||
.read(desktopContentProvider.notifier)
|
||||
.select(
|
||||
resources
|
||||
? DesktopContent.library
|
||||
: DesktopContent.workspace,
|
||||
);
|
||||
.select(surface);
|
||||
setState(() => _sidebarCollapsed = false);
|
||||
_saveViewState();
|
||||
if (navigationHiddenBySpace) {
|
||||
@@ -384,15 +515,23 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
VoidCallback? expandEditor,
|
||||
bool drawer = false,
|
||||
}) => ProjectSidebar(
|
||||
chatOnly: desktop,
|
||||
experience: experience,
|
||||
librarySelected:
|
||||
desktop && contentSelection.librarySelected,
|
||||
resourcesSelected:
|
||||
desktop && contentSelection.resourcesSelected,
|
||||
onResourcesSelected: desktop
|
||||
? (media) => selectSidebar(
|
||||
media
|
||||
? DesktopContent.library
|
||||
: DesktopContent.workspace,
|
||||
)
|
||||
: null,
|
||||
key: drawer
|
||||
? _drawerNavigationKey
|
||||
: _navigationKey,
|
||||
agent: desktop && !drawer
|
||||
? agent
|
||||
: const SizedBox.shrink(),
|
||||
agent: desktop ? agent : const SizedBox.shrink(),
|
||||
navigationOnly: true,
|
||||
onNavigationComplete: desktop && !drawer
|
||||
? null
|
||||
@@ -431,70 +570,66 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
onPressed: () =>
|
||||
Scaffold.of(context)
|
||||
.closeDrawer(),
|
||||
icon: const Icon(Icons.close),
|
||||
icon: const Icon(AppIcons.close),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
final pendingProject = _switchingProject
|
||||
? state.recent
|
||||
final selectedProjectId =
|
||||
_selectedProjectId ?? state.activeProject?.id;
|
||||
final pendingProject = _selectedProjectId == null
|
||||
? null
|
||||
: state.recent
|
||||
.where(
|
||||
(item) => item.id == _selectedProjectId,
|
||||
(item) => item.id == selectedProjectId,
|
||||
)
|
||||
.firstOrNull
|
||||
: null;
|
||||
final projectLoading =
|
||||
pendingProject != null &&
|
||||
pendingProject.id != state.activeProject?.id;
|
||||
.firstOrNull;
|
||||
final visibleProjects = [
|
||||
...openProjects,
|
||||
if (pendingProject != null &&
|
||||
!openProjects.any(
|
||||
(item) => item.id == pendingProject.id,
|
||||
))
|
||||
pendingProject,
|
||||
];
|
||||
final editor = ProjectSwitchRegion(
|
||||
pendingProjectId: projectLoading
|
||||
? pendingProject.id
|
||||
pendingProjectId:
|
||||
selectedProjectId != state.activeProject?.id
|
||||
? _selectedProjectId
|
||||
: null,
|
||||
builder: (context, showDefaults) {
|
||||
final displayDefaults =
|
||||
projectLoading && showDefaults;
|
||||
final visibleProject = displayDefaults
|
||||
? pendingProject
|
||||
: state.activeProject;
|
||||
return visibleProject != null &&
|
||||
(displayDefaults ||
|
||||
state.timeline != null)
|
||||
? EditorWorkspace(
|
||||
key: _editorKey,
|
||||
experience: experience,
|
||||
projectId: visibleProject.id,
|
||||
timelineId: displayDefaults
|
||||
? ''
|
||||
: state.visibleTimelineId!,
|
||||
projectName: visibleProject.name,
|
||||
projectLoading: displayDefaults,
|
||||
timelineLoading:
|
||||
state.openingTimelineId != null,
|
||||
showProjectName:
|
||||
desktop &&
|
||||
_mode == WorkspaceMode.cut,
|
||||
integratedTitlebar: false,
|
||||
headerLeading: desktop
|
||||
? const SizedBox.shrink()
|
||||
: const SizedBox(
|
||||
width: AppSpacing.compact,
|
||||
),
|
||||
)
|
||||
: EmptyEditor(
|
||||
desktop: desktop,
|
||||
state: state,
|
||||
showProjectName:
|
||||
desktop &&
|
||||
_mode == WorkspaceMode.cut,
|
||||
headerLeading: desktop
|
||||
? const SizedBox.shrink()
|
||||
: const SizedBox(
|
||||
width: AppSpacing.compact,
|
||||
),
|
||||
);
|
||||
},
|
||||
child:
|
||||
state.activeProject != null &&
|
||||
state.timeline != null
|
||||
? EditorWorkspace(
|
||||
key: _editorKey,
|
||||
experience: experience,
|
||||
projectId: state.activeProject!.id,
|
||||
timelineId: state.timeline!.id,
|
||||
projectName: state.activeProject!.name,
|
||||
timelineLoading:
|
||||
state.openingTimelineId != null,
|
||||
showProjectName: false,
|
||||
integratedTitlebar: false,
|
||||
headerLeading: desktop
|
||||
? const SizedBox.shrink()
|
||||
: const SizedBox(
|
||||
width: AppSpacing.compact,
|
||||
),
|
||||
)
|
||||
: EmptyEditor(
|
||||
experience: experience,
|
||||
desktop: desktop,
|
||||
state: state,
|
||||
showProjectName:
|
||||
desktop && _mode == WorkspaceMode.cut,
|
||||
headerLeading: desktop
|
||||
? const SizedBox.shrink()
|
||||
: const SizedBox(
|
||||
width: AppSpacing.compact,
|
||||
),
|
||||
),
|
||||
);
|
||||
Widget contentSurface(
|
||||
DesktopContent surface,
|
||||
@@ -534,6 +669,12 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
),
|
||||
child: SettingsContent(
|
||||
cardLayout: true,
|
||||
onBack: () => ref
|
||||
.read(
|
||||
desktopContentProvider
|
||||
.notifier,
|
||||
)
|
||||
.closeSettings(),
|
||||
initialTab:
|
||||
contentSelection.settingsTab,
|
||||
navigationRequest: contentSelection
|
||||
@@ -549,22 +690,105 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
return switch (experience) {
|
||||
DeviceExperience.desktop => DesktopWindowFrame(
|
||||
integratedTitlebar: integrated,
|
||||
headerControls: controls(),
|
||||
librarySelected:
|
||||
headerControls: const SizedBox.shrink(),
|
||||
projectTabs: ListenableBuilder(
|
||||
listenable: _desktopSplits,
|
||||
builder: (context, _) => ProjectTabsBar(
|
||||
projects: visibleProjects,
|
||||
recent: state.recent,
|
||||
selectedId: selectedProjectId,
|
||||
onSelect: (project) {
|
||||
ref
|
||||
.read(desktopContentProvider.notifier)
|
||||
.select(DesktopContent.workspace);
|
||||
selectProject(project);
|
||||
},
|
||||
onClose: _closeProjectTab,
|
||||
onCreate: () => _selectProject(
|
||||
context,
|
||||
ref,
|
||||
create: true,
|
||||
),
|
||||
onOpen: () => _selectProject(
|
||||
context,
|
||||
ref,
|
||||
create: false,
|
||||
),
|
||||
onRename: (project) =>
|
||||
_renameProject(context, ref, project),
|
||||
onRemoveRecent: _removeRecentProject,
|
||||
leadingActions: [
|
||||
IconButton(
|
||||
key: const Key(
|
||||
'project-sidebar-toggle',
|
||||
),
|
||||
tooltip:
|
||||
navigationCollapsed ||
|
||||
_desktopSplits.agentFloating
|
||||
? context.l10n.expandSidebar
|
||||
: context.l10n.collapseSidebar,
|
||||
onPressed: toggleSidebar,
|
||||
style: AppTheme.projectTabActionStyle(
|
||||
context,
|
||||
),
|
||||
icon: const Icon(
|
||||
AppIcons.sidebar,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
trailingActions: [
|
||||
IconButton(
|
||||
key: const Key('agent-minimize-button'),
|
||||
tooltip: _desktopSplits.agentFloating
|
||||
? context.l10n.agentDock
|
||||
: context.l10n.agentMinimize,
|
||||
onPressed: toggleAgentFloating,
|
||||
isSelected:
|
||||
_desktopSplits.agentFloating,
|
||||
style: AppTheme.projectTabActionStyle(
|
||||
context,
|
||||
),
|
||||
icon: const Icon(
|
||||
AppIcons.fullscreen,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
const BackgroundTasksButton(
|
||||
iconSize: 16,
|
||||
alignment:
|
||||
AlignmentDirectional.bottomEnd,
|
||||
),
|
||||
],
|
||||
projectMenuActions: [
|
||||
AppMenuItem(
|
||||
key: const Key(
|
||||
'project-settings-button',
|
||||
),
|
||||
label: context.l10n.settings,
|
||||
icon: AppIcons.settings,
|
||||
onPressed: () =>
|
||||
showSettingsPage(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
resourceLibrarySelected:
|
||||
contentSelection.surface ==
|
||||
DesktopContent.library,
|
||||
DesktopContent.resourceLibrary,
|
||||
onResourceLibraryPressed: () => selectSidebar(
|
||||
DesktopContent.resourceLibrary,
|
||||
),
|
||||
settingsSelected:
|
||||
contentSelection.surface ==
|
||||
DesktopContent.settings,
|
||||
onModeChanged: (mode) {
|
||||
selectSidebar(false);
|
||||
_setMode(mode);
|
||||
},
|
||||
onLibraryPressed: () => selectSidebar(true),
|
||||
onHomePressed: () =>
|
||||
selectSidebar(DesktopContent.workspace),
|
||||
onSettingsPressed: () =>
|
||||
showSettingsPage(context),
|
||||
child: desktopContents(
|
||||
DesktopWorkspaceShell(
|
||||
projectTabsLayout: true,
|
||||
controller: _desktopSplits,
|
||||
scaffoldKey: _desktopScaffoldKey,
|
||||
navigationDrawer: navigation(drawer: true),
|
||||
@@ -584,63 +808,90 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
geometry: geometry,
|
||||
expandEditor: expand,
|
||||
),
|
||||
agentBuilder: (geometry, expand) => Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
key: const Key(
|
||||
'agent-content-header',
|
||||
),
|
||||
height: AppControlSize.panelToolbar,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(
|
||||
AppSpacing.gap,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Spacer(),
|
||||
HeaderControlRegion(
|
||||
child: SizedBox.square(
|
||||
dimension: AppControlSize
|
||||
.headerButton,
|
||||
child: IconButton(
|
||||
key: const Key(
|
||||
'agent-fullscreen-button',
|
||||
agentBuilder: (geometry, expand) =>
|
||||
_desktopSplits.agentFloating
|
||||
? AgentPanelPresentation(
|
||||
compact: true,
|
||||
expanded: _desktopSplits
|
||||
.agentFloatingExpanded,
|
||||
onToggleExpanded: _desktopSplits
|
||||
.toggleFloatingConversation,
|
||||
onDock: () => _desktopSplits
|
||||
.setAgentFloating(false),
|
||||
child: agent,
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
key: const Key(
|
||||
'agent-content-header',
|
||||
),
|
||||
height: AppDesktopMetrics
|
||||
.panelHeader,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
),
|
||||
isSelected:
|
||||
geometry.editorHidden,
|
||||
tooltip:
|
||||
geometry.editorHidden
|
||||
? context
|
||||
.l10n
|
||||
.exitPreviewFullscreen
|
||||
: context
|
||||
.l10n
|
||||
.agentFullscreen,
|
||||
onPressed:
|
||||
geometry.editorHidden
|
||||
? expand
|
||||
: () => _desktopSplits
|
||||
.setAgentFullscreen(
|
||||
true,
|
||||
),
|
||||
icon: Icon(
|
||||
size:
|
||||
AppIconSize.header,
|
||||
geometry.editorHidden
|
||||
? Icons
|
||||
.fullscreen_exit
|
||||
: Icons.fullscreen,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
AppIcons.chat,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
context
|
||||
.l10n
|
||||
.workspaceAgent,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow
|
||||
.ellipsis,
|
||||
),
|
||||
),
|
||||
HeaderControlRegion(
|
||||
child: IconButton(
|
||||
key: const Key(
|
||||
'agent-fullscreen-button',
|
||||
),
|
||||
isSelected:
|
||||
_desktopSplits
|
||||
.agentFullscreen,
|
||||
tooltip:
|
||||
geometry
|
||||
.editorHidden
|
||||
? context
|
||||
.l10n
|
||||
.expandEditor
|
||||
: context
|
||||
.l10n
|
||||
.agentFullscreen,
|
||||
onPressed:
|
||||
geometry
|
||||
.editorHidden
|
||||
? expand
|
||||
: () => _desktopSplits
|
||||
.setAgentFullscreen(
|
||||
true,
|
||||
),
|
||||
icon: Icon(
|
||||
geometry.editorHidden
|
||||
? AppIcons
|
||||
.splitVertical
|
||||
: AppIcons
|
||||
.fullscreen,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(child: agent),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(child: agent),
|
||||
],
|
||||
),
|
||||
editor: editor,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user