Merge branch 'codex/web-home-without-global-sidebar'

This commit is contained in:
Haitao Pan 2026-03-24 21:04:52 +08:00
commit 679b7c7e2c
2 changed files with 20 additions and 5 deletions

View File

@ -83,6 +83,8 @@ class _AppShellState extends State<AppShell> {
child: LayoutBuilder(
builder: (context, constraints) {
final isMobile = constraints.maxWidth < 900;
final showWorkspaceSidebar =
currentDestination != WorkspaceDestination.assistant;
final expandedSidebarWidth = _clampSidebarWidth(
_sidebarExpandedWidth ??
_defaultSidebarWidth(
@ -142,7 +144,8 @@ class _AppShellState extends State<AppShell> {
return Row(
children: [
if (_sidebarState != AppSidebarState.hidden)
if (showWorkspaceSidebar &&
_sidebarState != AppSidebarState.hidden)
SidebarNavigation(
currentSection: currentDestination,
sidebarState: _sidebarState,
@ -183,7 +186,8 @@ class _AppShellState extends State<AppShell> {
controller.toggleAssistantNavigationDestination,
availableDestinations: controller.capabilities.allowedDestinations,
),
if (_sidebarState == AppSidebarState.expanded)
if (showWorkspaceSidebar &&
_sidebarState == AppSidebarState.expanded)
PaneResizeHandle(
axis: Axis.horizontal,
onDelta: (delta) {

View File

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:xworkmate/app/app.dart';
import 'package:xworkmate/widgets/sidebar_navigation.dart';
void main() {
testWidgets('web shell aligns with app workspace layout and expanded pages', (
@ -37,6 +38,7 @@ void main() {
findsOneWidget,
);
expect(find.text('连接设置'), findsNothing);
expect(find.byType(SidebarNavigation), findsNothing);
await tester.tap(
find.byKey(const Key('assistant-workspace-chrome-toggle')),
@ -108,20 +110,29 @@ void main() {
);
await tester.tap(
find.byKey(const ValueKey<String>('assistant-focus-add-tasks')),
find.byKey(const ValueKey<String>('assistant-focus-add-settings')),
);
await tester.pumpAndSettle();
expect(
find.byKey(const ValueKey<String>('assistant-focus-open-page-tasks')),
find.byKey(const ValueKey<String>('assistant-focus-open-page-settings')),
findsOneWidget,
);
await tester.tap(
find.byKey(const ValueKey<String>('assistant-focus-open-page-tasks')),
find.byKey(const ValueKey<String>('assistant-focus-open-page-settings')),
);
await tester.pumpAndSettle();
expect(find.byType(SidebarNavigation), findsOneWidget);
await tester.tap(
find.byKey(const ValueKey<String>('sidebar-favorite-tasks')),
);
await tester.pumpAndSettle();
await tester.tap(find.text('自动化'));
await tester.pumpAndSettle();
expect(find.text('任务工作台'), findsOneWidget);
await tester.tap(find.text('设置').last);