fix(client): 收下失败改 error_outline(图标层与颜色层对齐)+ 补符号护栏的行尾注释控制

图标与颜色是两层独立信号:_result 失败分支颜色是 danger(红),
图标却用属琥珀层的 warning_amber —— 两层互相取消,且与既有先例不一致
(pairing_card.dart:377 / viewer_page.dart:2013 都是 error_outline + danger)。
warning_amber 留给 suspect 层(走中继、会消耗流量之类)。

symbol_guard 补两条负控制,把为什么不剥注释钉成可执行断言:
· 文档注释里的 ✅❌★ 表格不误报(不区分注释的实现会在这种行上红一大片)
· 行尾注释不误报(剥 // 到行尾会把 'http://x' 后面的真违规一起吃掉)
This commit is contained in:
jkooe committed 2026-11-08 18:36:03 +08:00
1 parent bc6e5f405f
commit bd39799ab0
2 files changed
+23 -2

No files matched your search

+7 -2
View File
@@ -638,11 +638,16 @@ class _FileTransferCardState extends State<FileTransferCard> {
children: [
Row(
children: [
// 收下结果的状态图标:成功 = check_circle,警告 = warning_amber。
// 收下结果的状态图标:成功 = check_circle,失败 = error_outline。
// 失败用 error_outline 而**不是** warning_amber:图标与颜色是两层
// 独立信号,这里颜色是 danger(红),图标必须同属"错误"层;
// 配琥珀色图标会让两层互相取消,也与既有先例不一致
// (pairing_card.dart:377 / viewer_page.dart:2013 都是 error_outline+danger)。
// warning_amber 留给 suspect 层(如"走中继、会消耗流量")。
// 不用 ✓ / ⚠ 字符 —— 水墨屏上会渲染成方框,也无法着色。
Icon(_result!.verified
? Icons.check_circle
: Icons.warning_amber,
: Icons.error_outline,
size: 16,
color: _result!.verified
? PmonColors.online
+16
View File
@@ -158,6 +158,22 @@ void main() {
expect(findSymbolsInLiterals(comment), isEmpty);
});
test('文档注释里的 ✅ ❌ ★ 表格合法(不剥注释会在这里红一大片)', () {
// 实测:不区分注释时 lib/ 有几十处命中,几乎全是这种强调/表格记号。
// A 类门禁不接受行内豁免 —— 那种断言第一天就恒红,然后被删掉。
const table = '/// | 卡片 _formatValue | \u2705 | \u274C | \u274C |';
const emphasis = '/// \u2605 唯一真相源:这里的口径不许在别处再写一遍';
expect(findSymbolsInLiterals(table), isEmpty);
expect(findSymbolsInLiterals(emphasis), isEmpty);
});
test('★ 行尾注释也不误报(这是我不用"剥注释"实现的原因)', () {
// 若实现是"剥 // 到行尾",`'http://x'` 里的 // 会把后面整段吃掉;
// 若实现是"只剥整行注释",行尾注释里的符号就会误报。按引号区间判两头都对。
const trailing = "final ok = true; // 成功时用 \u2713,失败用 \u26A0";
expect(findSymbolsInLiterals(trailing), isEmpty);
});
test('文档注释里说明规则本身也合法', () {
const doc = '/// 不要用 \u2713 —— 水墨屏上会渲染成方框';
expect(findSymbolsInLiterals(doc), isEmpty);