style(月视图): 农历恢复原色,下方加浅红小圆点 #6

用户反馈:农历整体染红不好看(数据本身是对的,确实每天都有日程),
要求改成"农历下面一个浅红色的点,不要太红、不要太刺眼"。

## 改动
- 农历文字恢复原色(灰 / 选中日仍是提示灰),不再染红
- 农历**下方**单独一行放一个 3.5vp 小圆点
- 颜色新增 `soft_red`,不用之前的 event_mark(#D93025)
  · 浅色 #F2938A —— 带粉的浅红,是"柔和提示"而非"警报"
  · 深色 #C97A72 —— 黑底上浅粉会发灰,用稍沉的暖红
- 无事件时圆点透明但仍占位,保证有/无事件行高一致,整月不跳

## ⚠️ 两个必须处理的布局约束
1. **圆点必须独立成行**,不能塞进农历那一行的 Row 里。
   上一版就错在这:农历带 layoutWeight(1) 撑满整行,圆点被挤到行尾,
   视觉上贴着下一个日期。独立成行后天然居中在格子下方。

2. **格子高度已被占满**(实测 175px 全用尽),直接加一行会被顶出格子。
   所以把 Column space 从 2 收到 1、日期框 26→24,换出约 4px 给圆点。

周视图同步改成同一套标记,避免"月历一个样、周条另一个样"。
This commit is contained in:
2026-11-02 21:31:52 +08:00
parent 8ca1eb76e0
commit e92daf5297
3 changed files with 30 additions and 30 deletions
+26 -28
View File
@@ -1706,15 +1706,15 @@ struct Index {
.backgroundColor(cell.dateMs === this.selectedDate
? $r('app.color.selected_bg')
: (cell.isToday ? $r('app.color.today_bg') : Color.Transparent))
// ⭐ WEEK_TINT 与月视图统一:有事件 → 农历文字变主题色,不再画圆点。
// (两种视图用两套标记会让人以为是不同含义。)
// ⭐ WEEK_DOT_BELOW 与月视图统一:农历保持原色,下方一个浅红小点。
// (两套标记会让人以为是不同含义,上次已踩过。)
Text(cell.lunar)
.fontSize(8)
.fontColor(cell.dateMs === this.selectedDate
? (cell.hasEvent ? $r('app.color.button_text') : $r('app.color.text_secondary'))
: (cell.hasEvent ? $r('app.color.event_mark') : $r('app.color.text_hint')))
.fontWeight(cell.hasEvent ? FontWeight.Medium : FontWeight.Normal)
.fontColor($r('app.color.text_hint'))
.maxLines(1)
Circle({ width: 3.5, height: 3.5 })
.fill($r('app.color.soft_red'))
.opacity(cell.hasEvent ? 1 : 0)
}
.layoutWeight(1)
.onClick(() => {
@@ -3258,46 +3258,44 @@ struct Index {
@Builder
dayCell(cell: MonthCell) {
Column({ space: 2 }) {
// space 从 2 收到 1、日期框 26→24:格子高度原本已被"日期+农历"占满,
// 不收一点空间,新加的圆点会被顶出格子(实测 175px 全用尽)。
Column({ space: 1 }) {
Text(String(cell.day))
.fontSize(this.wideLayout ? 12 : 13)
.fontWeight(cell.isToday || cell.dateMs === this.selectedDate ? FontWeight.Bold : FontWeight.Normal)
.fontColor(!cell.inMonth
? $r('app.color.text_hint')
: (cell.dateMs === this.selectedDate ? $r('app.color.button_text') : $r('app.color.text_primary')))
.width(this.wideLayout ? 22 : 26)
.height(this.wideLayout ? 22 : 26)
.width(this.wideLayout ? 22 : 24)
.height(this.wideLayout ? 22 : 24)
.textAlign(TextAlign.Center)
.borderRadius(this.wideLayout ? 11 : 13)
.borderRadius(this.wideLayout ? 11 : 12)
.backgroundColor(cell.dateMs === this.selectedDate
? $r('app.color.selected_bg')
: (cell.isToday ? $r('app.color.today_bg') : Color.Transparent))
// ⭐ LUNAR_TINT 有事件的日期标记 = **农历文字变色**(不再画圆点)。
// ⭐ DOT_BELOW 有事件的标记 = 农历**下方**一个浅红小圆点。
//
// 为什么弃用圆点:圆点塞在农历行的 Row 里,而农历用了 layoutWeight(1)
// 撑满整行,圆点被挤到格子最右侧;格子宽 133px 远大于文字宽,
// 视觉上就成了"贴着下一个日期",很怪。
// 视觉取舍:
// · 农历文字保持原色(灰/白),不染红 —— 整月染红不好看,用户否掉了
// · 圆点用 soft_red(浅红),不用 event_mark(#D93025) 那种警示红,
// 因为"这天有安排"是中性信息,不该有告警感
// · 点很小(3.5vp),存在感低,不抢日期数字
//
// 改成给农历文字本身染色:位置天然跟着文字走,不额外占空间,
// 也不会像"满屏红点"那样显得乱(那正是上一版被砍掉的原因)。
//
// 对比度:选中日的日期数字坐在深色底上,农历若还用主题蓝会看不清,
// 所以选中日改用 button_text(白);其余有事件的日用 brand。
// ⚠️ 位置:放在 Column 里**独立一行**,居中。
// 上一版把点放在农历同一行的 Row 里,农历 layoutWeight(1) 撑满整行,
// 点被挤到行尾 ⇒ 贴着下一个日期,很怪。独立成行就不会跑偏。
if (!this.wideLayout) {
// 宽屏下月历格子变窄,仍保留点(用一个小圆点补位,宽度足够)
Text(cell.lunar)
.fontSize(8)
.fontColor(cell.dateMs === this.selectedDate
? (cell.hasEvent ? $r('app.color.button_text') : $r('app.color.text_secondary'))
: (cell.hasEvent ? $r('app.color.event_mark') : $r('app.color.text_hint')))
.fontWeight(cell.hasEvent ? FontWeight.Medium : FontWeight.Normal)
? $r('app.color.text_secondary') : $r('app.color.text_hint'))
.maxLines(1)
} else {
// 宽屏:农历被省略,用一个小圆点表示(此时格子窄,圆点就在正中,不会有位置问题)
Circle({ width: 4, height: 4 })
.fill(cell.hasEvent ? $r('app.color.event_mark') : Color.Transparent)
.opacity(cell.hasEvent ? 1 : 0)
}
// 无事件时圆点透明但仍占位:保证有/无事件的行高完全一致,整月不会跳
Circle({ width: this.wideLayout ? 4 : 3.5, height: this.wideLayout ? 4 : 3.5 })
.fill($r('app.color.soft_red'))
.opacity(cell.hasEvent ? 1 : 0)
}
.layoutWeight(1)
.padding({ top: this.wideLayout ? 2 : 3, bottom: this.wideLayout ? 2 : 3 })
@@ -20,6 +20,7 @@
{ "name": "today_bg", "value": "#14007DFF" },
{ "name": "selected_bg", "value": "#007DFF" },
{ "name": "chip_off_bg", "value": "#0D000000" },
{ "name": "event_mark", "value": "#D93025" }
{ "name": "event_mark", "value": "#D93025" },
{ "name": "soft_red", "value": "#F2938A" }
]
}
@@ -20,6 +20,7 @@
{ "name": "today_bg", "value": "#330A84FF" },
{ "name": "selected_bg", "value": "#0A84FF" },
{ "name": "chip_off_bg", "value": "#1FFFFFFF" },
{ "name": "event_mark", "value": "#FF6B60" }
{ "name": "event_mark", "value": "#FF6B60" },
{ "name": "soft_red", "value": "#C97A72" }
]
}