fix(devices): 本机也显示 ⋯ 菜单(只「重命名」)—— 修单设备无法改名(1.0.14)
ci-pangolin / Lint — shellcheck (push) Successful in 8s
ci-pangolin / OpenAPI Sync Check (push) Successful in 16s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 6s
ci-pangolin / Flutter — analyze + test (push) Failing after 14s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 4s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Successful in 5s
ci-pangolin / Go — build + test (push) Successful in 9s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Successful in 15s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 4m10s
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Successful in 14s

之前 ⋯ 菜单对本机隐藏,而用户唯一设备就是本机 → 根本点不到、改不了名。
改:本机显示 ⋯ 菜单但只含「重命名」(自我强制退出/清除无意义,仍只对他设备)。
测试:本机菜单只有重命名断言;全量 flutter 绿。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-29 09:49:09 +08:00
parent 315c343ed5
commit 880fa32793
4 changed files with 30 additions and 18 deletions
+13 -10
View File
@@ -188,7 +188,7 @@ class DevicesScreen extends ConsumerWidget {
),
const SizedBox(width: 8),
_statusDot(c, d.online),
if (!isLocal) _menu(context, ref, c, d) else const SizedBox(width: 8),
_menu(context, ref, c, d, isLocal),
]),
);
}
@@ -214,7 +214,8 @@ class DevicesScreen extends ConsumerWidget {
]);
}
Widget _menu(BuildContext context, WidgetRef ref, PangolinScheme c, Device d) => PopupMenuButton<String>(
// 本机:只给「重命名」(自我踢下线/清除没意义);其他设备:重命名+强制退出+清除。
Widget _menu(BuildContext context, WidgetRef ref, PangolinScheme c, Device d, bool isLocal) => PopupMenuButton<String>(
icon: Icon(PangolinIcons.moreVertical, size: 18, color: c.fg3),
color: c.surface,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(PangolinRadius.md), side: BorderSide(color: c.border)),
@@ -223,14 +224,16 @@ class DevicesScreen extends ConsumerWidget {
Icon(PangolinIcons.edit, size: 16, color: c.fg2), const SizedBox(width: 10),
Text(t.devRename, style: PangolinText.sm.copyWith(color: c.fg1)),
])),
PopupMenuItem(value: 'logout', child: Row(children: [
Icon(PangolinIcons.logOut, size: 16, color: c.fg2), const SizedBox(width: 10),
Text(t.devForceLogout, style: PangolinText.sm.copyWith(color: c.fg1)),
])),
PopupMenuItem(value: 'clear', child: Row(children: [
Icon(PangolinIcons.trash, size: 16, color: c.danger), const SizedBox(width: 10),
Text(t.devClearLogin, style: PangolinText.sm.copyWith(color: c.danger)),
])),
if (!isLocal) ...[
PopupMenuItem(value: 'logout', child: Row(children: [
Icon(PangolinIcons.logOut, size: 16, color: c.fg2), const SizedBox(width: 10),
Text(t.devForceLogout, style: PangolinText.sm.copyWith(color: c.fg1)),
])),
PopupMenuItem(value: 'clear', child: Row(children: [
Icon(PangolinIcons.trash, size: 16, color: c.danger), const SizedBox(width: 10),
Text(t.devClearLogin, style: PangolinText.sm.copyWith(color: c.danger)),
])),
],
],
onSelected: (v) async {
if (v == 'rename') {