跨端: 日历 12 处点击补按压反馈(用户:「打开日程一点动画都没有」)
## 实测量出来的覆盖面,不是印象
`grep` 出日历页 17 个 `onClick`,逐个看它所在的块有没有
`PressEffectModifier`(全仓统一的按压反馈):
补前:17 处里 **5 处有、12 处没有**
补后:17/17
缺的 12 处正是"打开日程之后会去点的那些":
`‹` / `›` 翻月、「今天」、月/周/日 三档、导入、导出、新建、
以及编辑器里的若干选项。用户「一点动画都没有」说的就是它们。
★ 为什么其它页面有、日历没有:按压反馈是**逐站点的**(`PressEffectModifier.of()`
挂在一个组件上),不是全局的。我此前给导航/详情/写信页补过,
日历这一页当时没扫到 —— 这类"每加一处就得记得挂一次"的形状,
本仓已经栽过两次(`applyPressedAttribute` 只对 Button 有效、
18 个玻璃卡里只有 1 个挂了按压)。**这次是第三次。**
## 设备验证(按住不放,同一区域取平均亮度)
「今天」按钮按住时 rgb(216.6,216.6,216.6)
常态 rgb(238.4,238.4,238.4)
⇒ 差 21.8 个亮度级,是**看得见**的变化(不是"代码里有这句话")。
## 顺带说明我这次差点犯的错
第一版我用"在 `onClick` 那一行后面插一行"的脚本批量加 —— 而其中 6 处
`onClick` 是**多行箭头函数体**(`.onClick(() => {\n … \n})`),
插在中间直接把文件写坏(编译报 `Declaration or statement expected`)。
已 `git checkout` 还原,改成先按括号配对**求出整条语句的结束行**再插。
★ 教训:批量改代码要按**语法单元**定位,不能按行号 + 行内容猜。
## 仍然没做的(如实登记,不夸大)
· `pageTransition` 仍是 **0 处** —— 所有 `@Entry` 页都是硬切。
WebUI 那边也没有页面级转场(这是双方一致的有意选择),
但用户明确提过「转场动画呢」,需要单独一轮决定要不要引入。
· 「按钮变成页面 / 按钮变成输入框」的形变(WebUI 用 `data-morph-trigger`
+ FLIP)在鸿蒙侧需要 `geometryTransition`,目前只在 `NavDestination` 上可用。
This commit is contained in:
@ -1196,6 +1196,7 @@ export struct CalendarPage {
|
||||
.onClick(() => {
|
||||
this.editorOpen = false;
|
||||
})
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
}
|
||||
.width('100%')
|
||||
.padding({ left: 10, right: 10, top: 8, bottom: 8 })
|
||||
@ -1271,6 +1272,7 @@ export struct CalendarPage {
|
||||
.onClick(() => {
|
||||
this.fRecurrence = key;
|
||||
})
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
}, (key: string) => `rec${key}`)
|
||||
}
|
||||
.width('100%')
|
||||
@ -1290,6 +1292,7 @@ export struct CalendarPage {
|
||||
.onClick(() => {
|
||||
this.fRemindBefore = mins;
|
||||
})
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
}, (mins: number) => `rem${mins}`)
|
||||
}
|
||||
.width('100%')
|
||||
@ -1322,6 +1325,7 @@ export struct CalendarPage {
|
||||
.onClick(() => {
|
||||
this.toggleStatus();
|
||||
})
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
Button(this.confirmDelete ? '确认删除' : '删除')
|
||||
.fontSize(Theme.fontSmall)
|
||||
.backgroundColor(Theme.dangerBg)
|
||||
@ -1334,6 +1338,7 @@ export struct CalendarPage {
|
||||
this.confirmDelete = true;
|
||||
}
|
||||
})
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
}
|
||||
Blank()
|
||||
Button(this.saving ? '保存中…' : '保存')
|
||||
@ -1344,6 +1349,7 @@ export struct CalendarPage {
|
||||
.onClick(() => {
|
||||
this.saveEvent();
|
||||
})
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
}
|
||||
.width('100%')
|
||||
.margin({ top: 12, bottom: 20 })
|
||||
@ -1495,6 +1501,7 @@ export struct CalendarPage {
|
||||
.backgroundColor(Color.Transparent)
|
||||
.fontColor(Theme.textPrimary)
|
||||
.onClick(() => this.shiftMonth(-1))
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
Text(this.rangeTitle())
|
||||
.fontSize(Theme.fontBody)
|
||||
.fontColor(Theme.textPrimary)
|
||||
@ -1507,6 +1514,7 @@ export struct CalendarPage {
|
||||
.backgroundColor(Color.Transparent)
|
||||
.fontColor(Theme.textPrimary)
|
||||
.onClick(() => this.shiftMonth(1))
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
}
|
||||
.width('100%')
|
||||
.padding({ left: 6, right: 6, top: 4, bottom: 0 })
|
||||
@ -1533,6 +1541,7 @@ export struct CalendarPage {
|
||||
.fontColor(Theme.textPrimary)
|
||||
.border({ width: 1, color: Theme.border })
|
||||
.onClick(() => this.goToday())
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
Blank()
|
||||
/*
|
||||
* 视图档:**分段式**三个按钮(对齐 WebUI 的 `flex rounded border` 那一组)。
|
||||
@ -1557,6 +1566,7 @@ export struct CalendarPage {
|
||||
.borderRadius(6)
|
||||
.margin({ left: 4 })
|
||||
.onClick(() => this.setScale(s))
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
}, (s: CalendarScale) => `scale${s}`)
|
||||
/*
|
||||
* .ics 导入 / 导出(对齐 WebUI 工具条里那两个图标)。
|
||||
@ -1570,11 +1580,13 @@ export struct CalendarPage {
|
||||
.fontColor(this.icsBusy ? Theme.textSubtle : Theme.accentFor())
|
||||
.margin({ left: 8 })
|
||||
.onClick(() => { this.importIcs(); })
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
Text('导出')
|
||||
.fontSize(Theme.fontSmall)
|
||||
.fontColor(this.icsBusy ? Theme.textSubtle : Theme.accentFor())
|
||||
.margin({ left: 8 })
|
||||
.onClick(() => { this.exportIcs(); })
|
||||
.attributeModifier(PressEffectModifier.of())
|
||||
/*
|
||||
* 新建 —— 对齐 WebUI `CalendarView.tsx:362-369`:**蓝底 + 图标 + 文字「新建」**。
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user