feat(app-iced): 选中项叠状态层收口到一处,导入向导的版本行不再「选中就没反馈」(M296)
用户 2026-11-13:已选中的控件在悬停/按下时没有任何反馈。塔裁决「要加」—— MD3 的行为是选中容器(SecondaryContainer)上**再叠**状态层,两者不互斥。 枚举(全仓 grep SecondaryContainer / selected + fill,表见报告)后事实是 3/4 已做: 菜单项(inputs/menu.rs)、列表行(navigation/list_item.rs)、导航项药丸 (navigation/drawer/item.rs)各自写了一遍同一个 6 行形状;真正「死」的是导入向导的 版本选择行(app/adopt/pick.rs:底色写死在容器样式里,按钮样式恒 None)。 三件事: 1. 抽 interaction::selected_fill(ui, state, content, container)——第三次法则的落点, 与未选中态的 layer_color 分两条(未选中静息没有底,选中项静息有底); 2. 三处拷贝收敛到它(menu / list_item 从 overlay_color 升到带时间轴的 layer_color, 无取样控件时逐位相同;drawer 只换入口); 3. pick.rs 的候选行底色搬进 button 的样式闭包 → 选中行按 hover 8% / pressed 10% 叠层; 未选中行仍恒 None。 判据:rest 图 16/16 md5 与改动前全等(含 adopt-pick-selected);列表选中行 rest/hover/pressed 三色互异(浅 212,228,246 / 196,212,230 / 192,208,225);变异把 selected_fill 改回「不叠」→ 7 条单测红 + 该行三张图逐像素相同(1/3)。 全量 cargo test -p unlucky-app-iced --lib:1017 passed / 0 failed。
This commit is contained in:
1 parent
0e5944045a
commit
638e2a3efe
9 files changed
+391
-41
No files matched your search
@@ -192,16 +192,14 @@ fn item_palette(ui: &Ui, base: Base, state: Interaction, selected: bool) -> Item
|
||||
}
|
||||
|
||||
if selected {
|
||||
// 选中项也要跟态走:状态层叠在 SecondaryContainer 上(不透明结果,D27)
|
||||
let fill = interaction::overlay_color(
|
||||
ui,
|
||||
state,
|
||||
Role::OnSecondaryContainer,
|
||||
Role::SecondaryContainer,
|
||||
)
|
||||
.unwrap_or_else(|| ui.color(Role::SecondaryContainer));
|
||||
// 选中项也要跟态走:状态层叠在 SecondaryContainer 上(唯一入口 `interaction::selected_fill`)
|
||||
return ItemPalette {
|
||||
fill: Some(fill),
|
||||
fill: Some(interaction::selected_fill(
|
||||
ui,
|
||||
state,
|
||||
Role::OnSecondaryContainer,
|
||||
Role::SecondaryContainer,
|
||||
)),
|
||||
ink: ui.color(Role::OnSecondaryContainer),
|
||||
icon: ui.color(Role::OnSecondaryContainer),
|
||||
shape: ShapeScale::Small,
|
||||
|
||||
Reference in new issue
Block a user