diff --git a/lib/app/app_shell_desktop.dart b/lib/app/app_shell_desktop.dart index 8361e42e..af2a0dd9 100644 --- a/lib/app/app_shell_desktop.dart +++ b/lib/app/app_shell_desktop.dart @@ -8,7 +8,6 @@ import '../theme/app_palette.dart'; import '../theme/app_theme.dart'; import '../widgets/detail_drawer.dart'; import '../widgets/pane_resize_handle.dart'; -import '../widgets/app_brand_logo.dart'; import '../widgets/sidebar_navigation.dart'; import 'app_controller.dart'; import 'workspace_page_registry.dart'; @@ -470,8 +469,8 @@ class _SidebarRevealRailState extends State<_SidebarRevealRail> { boxShadow: _hovered ? [palette.chromeShadowLift] : const [], ), child: _hovered - ? DoorLogoIcon( - side: DoorLogoSide.left, + ? Icon( + Icons.chevron_right_rounded, size: 16, color: palette.textMuted, ) diff --git a/lib/widgets/sidebar_navigation.dart b/lib/widgets/sidebar_navigation.dart index 2a3c9837..baddc3de 100644 --- a/lib/widgets/sidebar_navigation.dart +++ b/lib/widgets/sidebar_navigation.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; -import 'app_brand_logo.dart'; import '../i18n/app_language.dart'; import '../models/app_models.dart'; import '../theme/app_palette.dart'; @@ -224,21 +223,64 @@ class SidebarHeader extends StatelessWidget { @override Widget build(BuildContext context) { - final content = AppBrandLogo( + final content = _SidebarHeaderChevron( size: isCollapsed ? 36 : 28, borderRadius: isCollapsed ? 10 : 8, ); + final alignedContent = Align( + alignment: Alignment.centerRight, + child: content, + ); if (onTap == null) { - return content; + return alignedContent; } return Tooltip( message: appText('展开导航', 'Expand sidebar'), - child: InkWell( - borderRadius: BorderRadius.circular(AppRadius.button), - onTap: onTap, - child: Padding(padding: EdgeInsets.zero, child: content), + child: Align( + alignment: Alignment.centerRight, + child: InkWell( + borderRadius: BorderRadius.circular(AppRadius.button), + onTap: onTap, + child: Padding(padding: EdgeInsets.zero, child: content), + ), + ), + ); + } +} + +class _SidebarHeaderChevron extends StatelessWidget { + const _SidebarHeaderChevron({required this.size, required this.borderRadius}); + + final double size; + final double borderRadius; + + @override + Widget build(BuildContext context) { + final palette = context.palette; + return Container( + width: size, + height: size, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + palette.chromeHighlight.withValues(alpha: 0.9), + palette.chromeSurface, + ], + ), + borderRadius: BorderRadius.circular(borderRadius), + border: Border.all(color: palette.chromeStroke), + boxShadow: [palette.chromeShadowAmbient], + ), + child: Center( + child: Icon( + Icons.chevron_right_rounded, + size: size * 0.72, + color: palette.textSecondary, + ), ), ); } diff --git a/test/widgets/sidebar_navigation_suite.dart b/test/widgets/sidebar_navigation_suite.dart index 096a4301..737c77d8 100644 --- a/test/widgets/sidebar_navigation_suite.dart +++ b/test/widgets/sidebar_navigation_suite.dart @@ -6,6 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:xworkmate/i18n/app_language.dart'; import 'package:xworkmate/models/app_models.dart'; import 'package:xworkmate/theme/app_theme.dart'; +import 'package:xworkmate/widgets/app_brand_logo.dart'; import 'package:xworkmate/widgets/sidebar_navigation.dart'; void main() { @@ -154,4 +155,35 @@ void main() { expect(selected, WorkspaceDestination.settings); }, ); + + testWidgets('SidebarNavigation header uses chevron instead of brand logo', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + MaterialApp( + theme: AppTheme.light(), + home: Scaffold( + body: SidebarNavigation( + currentSection: WorkspaceDestination.assistant, + sidebarState: AppSidebarState.expanded, + appLanguage: AppLanguage.zh, + themeMode: ThemeMode.light, + onSectionChanged: (_) {}, + onToggleLanguage: () {}, + onCycleSidebarState: () {}, + onExpandFromCollapsed: () {}, + onOpenHome: () {}, + onOpenAccount: () {}, + onOpenThemeToggle: () {}, + accountName: 'Tester', + accountSubtitle: 'Workspace', + ), + ), + ), + ); + await tester.pumpAndSettle(); + + expect(find.byIcon(Icons.chevron_right_rounded), findsOneWidget); + expect(find.byType(AppBrandLogo), findsNothing); + }); }