style(账号): 日历本类型图标改用 SVG 线性图标 #6

用户反馈字符图标(▦ / ✓)不好看。

## 为什么字符图标不行
- `▦` 在多数系统字体里缺字形,会 fallback 成方框或模糊图案
- `✓` 与 `▦` 笔画粗细、视觉重量完全不同,并排放不协调
- 13 号字时对齐依赖 font metrics,跨设备会飘

## 换成一对自绘 SVG
`ic_event_book.svg`:日历轮廓 + 两个日期格(填充)
`ic_todo_book.svg` :清单三条 + 右下角勾

两者**共用同一套笔触**:stroke-width 2、round linecap、24×24 viewBox,
渲染成 16vp 时视觉重量一致。颜色分别为灰 #666666 与绿 #00B34A,
沿用项目里已有的"待办用成功色"约定。

## 校验方式
本地无 SVG 渲染工具(无 cairosvg/rsvg/inkscape),改用脚本按坐标
+ 描边半宽计算每个元素的包围盒,确认全部落在 24×24 内不被裁切:
  日历:6 个元素 全部在界内
  待办:5 个元素 全部在界内
这是静态校验,实际观感仍需真机确认。

## 混合本(both)
显示待办图标(它确实能存待办),不再塞两个图标挤一行。
This commit is contained in:
2026-11-02 22:35:25 +08:00
parent 09cb0f9664
commit 24cd51970c
3 changed files with 37 additions and 23 deletions
+14 -22
View File
@@ -544,30 +544,22 @@ struct EditCalendarRow {
build() {
Row({ space: 12 }) {
// ⭐ COMPS_ICON 类型图标:放在颜色圆点**前面**,
// ⭐ SVG_ICON 类型图标:放在颜色圆点**前面**,
// 让用户先看清"这本是日历还是待办",再看它是什么颜色。
// 混合本两个图标都显示(服务器同时支持 VEVENT 和 VTODO)。
if (this.item.comps === 'todo') {
Text('✓')
.fontSize(13)
.fontColor($r('app.color.success'))
//
// 用 SVG 而不是字符:字符图标(▦ / ✓)依赖系统字体字形,
// 笔画粗细与视觉重量不统一,跨设备还可能缺字形变成方框。
// 这两个 SVG 共用同一套笔触(stroke 2、round 端点、24×24),
// 渲染成 16vp 时重量一致。
//
// 混合本(both):显示待办图标(它确实能存待办),
// 但用户看名字/颜色仍能分辨,不必塞两个图标挤在一行。
Image(this.item.comps === 'todo' || this.item.comps === 'both'
? $r('app.media.ic_todo_book')
: $r('app.media.ic_event_book'))
.width(16)
.textAlign(TextAlign.Center)
} else if (this.item.comps === 'both') {
Text('▦✓')
.fontSize(13)
.fontColor($r('app.color.text_secondary'))
.width(16)
.textAlign(TextAlign.Center)
} else {
// 'event' 或 'unknown':一律显示日历图标
// (unknown 是服务器未声明,按日历对待,不要凭空标成待办)
Text('▦')
.fontSize(13)
.fontColor($r('app.color.text_secondary'))
.width(16)
.textAlign(TextAlign.Center)
}
.height(16)
.objectFit(ImageFit.Contain)
if (this.item.color !== '') {
Circle()
.width(12)
@@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<!-- 日历本图标:线性风格,与 todo_book 同一套笔触(stroke 2, round 端点) -->
<rect x="3" y="5" width="18" height="16" rx="3" fill="none" stroke="#666666" stroke-width="2"/>
<path d="M3 10 H21" fill="none" stroke="#666666" stroke-width="2" stroke-linecap="round"/>
<!-- 两个挂环 -->
<path d="M8 3 V7" fill="none" stroke="#666666" stroke-width="2" stroke-linecap="round"/>
<path d="M16 3 V7" fill="none" stroke="#666666" stroke-width="2" stroke-linecap="round"/>
<!-- 日期格:用两个小方块暗示"日程格" -->
<rect x="7" y="13" width="3.5" height="3.5" rx="1" fill="#666666"/>
<rect x="13.5" y="13" width="3.5" height="3.5" rx="1" fill="#666666"/>
</svg>

After

Width:  |  Height:  |  Size: 792 B

@@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<!-- 待办本图标:与 ic_event_book 同一套笔触,用"清单+勾"表达待办 -->
<rect x="3" y="4" width="18" height="17" rx="3" fill="none" stroke="#00B34A" stroke-width="2"/>
<!-- 三条清单项 -->
<path d="M7 9 H17" fill="none" stroke="#00B34A" stroke-width="2" stroke-linecap="round"/>
<path d="M7 13.5 H14" fill="none" stroke="#00B34A" stroke-width="2" stroke-linecap="round"/>
<path d="M7 18 H12" fill="none" stroke="#00B34A" stroke-width="2" stroke-linecap="round"/>
<!-- 右下角一个勾,强调"待办"语义 -->
<path d="M15 17 L17 19 L21 14.5" fill="none" stroke="#00B34A" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 779 B