From a8e29a641ac51c34b25a714478b5f2124ff89d3a Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Thu, 18 Jun 2026 08:57:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(client):=20=E9=80=80=E5=87=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=BD=92=E5=85=A5=E7=94=A8=E6=88=B7=E5=90=8D=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 侧栏底部用户名行改为可点击的 PopupMenuButton,点击弹出账号菜单, 退出登录移入其中;移除原用户名行直接打开门店信息面板的入口。 设备管理保持在侧栏导航不变。 Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Y2Wdwo7SmgBJU37cBrkhPK --- client/lib/screens/shell/app_shell.dart | 101 ++++++++++-------------- 1 file changed, 40 insertions(+), 61 deletions(-) diff --git a/client/lib/screens/shell/app_shell.dart b/client/lib/screens/shell/app_shell.dart index 6e124e4..d77925d 100644 --- a/client/lib/screens/shell/app_shell.dart +++ b/client/lib/screens/shell/app_shell.dart @@ -300,68 +300,37 @@ class _AppShellState extends ConsumerState { }).toList(), ), ), - // 当前登录账号(顶栏移下来的用户名):点击弹门店/账号/版本面板 + // 当前登录账号:点击弹下拉菜单(退出登录) if (user != null) ...[ const Divider(height: 1, color: Colors.white24), - SizedBox( - height: 48, - child: Material( - color: Colors.transparent, - child: InkWell( - onTap: () => _showShopPanel(context, user, - version: appVersion), - hoverColor: Colors.white.withAlpha(13), - splashColor: Colors.white.withAlpha(26), - child: Row( - children: [ - SizedBox( - width: _sidebarExpanded ? 16 : 3), - Expanded( - child: Row( - mainAxisAlignment: _sidebarExpanded - ? MainAxisAlignment.start - : MainAxisAlignment.center, - children: [ - const Icon(Icons.person_outline, - color: Colors.white60, - size: 20), - if (_sidebarExpanded) ...[ - const SizedBox(width: 12), - Expanded( - child: Text( - user.username, - style: const TextStyle( - color: Colors.white70, - fontSize: 14), - overflow: - TextOverflow.ellipsis, - ), - ), - ], - ], - ), - ), - ], - ), - ), - ), - ), - ], - // 退出登录(侧栏底部常驻;统一为左侧导航唯一退出入口) - const Divider(height: 1, color: Colors.white24), - SizedBox( - height: 48, - child: Material( - color: Colors.transparent, - child: InkWell( - onTap: () { + PopupMenuButton( + tooltip: '账号菜单', + position: PopupMenuPosition.over, + offset: const Offset(0, -8), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6)), + color: Colors.white, + elevation: 8, + onSelected: (v) { + if (v == 'logout') { ref .read(authStateProvider.notifier) .logout(); context.go('/login'); - }, - hoverColor: Colors.white.withAlpha(13), - splashColor: Colors.white.withAlpha(26), + } + }, + itemBuilder: (context) => const [ + PopupMenuItem( + value: 'logout', + padding: EdgeInsets.zero, + child: _HoverMenuItem( + icon: Icons.logout, + label: '退出登录', + ), + ), + ], + child: SizedBox( + height: 48, child: Row( children: [ SizedBox(width: _sidebarExpanded ? 16 : 3), @@ -371,14 +340,24 @@ class _AppShellState extends ConsumerState { ? MainAxisAlignment.start : MainAxisAlignment.center, children: [ - const Icon(Icons.logout, + const Icon(Icons.person_outline, color: Colors.white60, size: 20), if (_sidebarExpanded) ...[ const SizedBox(width: 12), - const Text('退出登录', - style: TextStyle( + Expanded( + child: Text( + user.username, + style: const TextStyle( color: Colors.white70, - fontSize: 14)), + fontSize: 14), + overflow: TextOverflow.ellipsis, + ), + ), + const Icon( + Icons.keyboard_arrow_up, + color: Colors.white38, + size: 18), + const SizedBox(width: 12), ], ], ), @@ -387,7 +366,7 @@ class _AppShellState extends ConsumerState { ), ), ), - ), + ], const SizedBox(height: 8), ], ),