fix(design,app-iced): 图标尺寸与禁用 α 收敛到官方字节码,两族拆开(M86)

图标:IconSize::Button 16→18(AAR ButtonDefaults.<clinit> 的 bipush 18);新增
IconSize::SwitchThumb=16(SwitchTokens.Selected/UnselectedIconSize)承接开关滑块,按钮与
滑块不再借同一档;IconSize::Nav 的值不动但文档订正(无消费,官方导航/列表图标是 24)。
ButtonSmallTokens.IconSize=20 在整包 AAR 里零消费(javap 搜 getIconSize 无外部调用),
是死令牌,不再作为取值依据。

禁用 α:官方本来就分两族——按钮容器 0.10(*ButtonTokens.DisabledContainerOpacity)与
面状控件 0.12(chip 描边 / slider 轨道 / switch 轨道)。原来的缺陷是一个全局 12% 同时
服务两族(按钮那半边一直错、另半边一直对),现拆成 disabled_button_colors/…_content
与 disabled_colors/disabled_content_over_role 两个入口;interaction 首次超 400 行,
禁用口径与测试搬到 interaction/disabled.rs。

标题栏 caption 三键:官方 SmallIconButtonTokens.IconSize=24,按用户点名缩到 20
(容器 46×48 不动),登记为项目偏离;icons.rs 加按令牌取尺寸的入口 view_at,按
(种类,尺寸) 分别烘焙 SVG,20px 的 stroke 取 1.8 保视觉线宽 1.5px。
This commit is contained in:
AskaEth committed 2026-11-02 13:12:11 +08:00
1 parent c825e1aa3d
commit b566097107
16 files changed
+664 -175

No files matched your search

@@ -143,13 +143,13 @@ pub(super) fn content_color(
disabled_content: Role,
) -> iced::Color {
match forced {
// 有容器:38% 叠在**12% 容器**上(Filled / Tonal / Elevated)
// 有容器:38% 叠在**按钮家族 10% 容器**上(Filled / Tonal / Elevated)
Some(Interaction::Disabled) if fill.is_some() => {
interaction::disabled_content_over_role(ui, disabled_content, true)
interaction::disabled_button_content(ui, disabled_content, true)
}
// 无容器:38% 直接叠在 **surface** 上(Text / Outlined / standard IconButton)
Some(Interaction::Disabled) => {
interaction::disabled_content_over_role(ui, disabled_content, false)
interaction::disabled_button_content(ui, disabled_content, false)
}
_ => ui.color(content),
}
@@ -167,7 +167,7 @@ pub(super) fn style_closure(
.unwrap_or_else(|| Interaction::from_status(status));
let (background, text_color) = if state.is_disabled() {
let (container, content) = interaction::disabled_colors(ui, Role::Surface);
let (container, content) = interaction::disabled_button_colors(ui, Role::Surface);
// 透明容器在禁用态依然透明(官方只改内容透明度)
(spec.fill.map(|_| container), content)
} else {
@@ -184,7 +184,7 @@ pub(super) fn style_closure(
};
let border_color = if state.is_disabled() {
interaction::disabled_colors(ui, Role::Surface).0
interaction::disabled_button_colors(ui, Role::Surface).0
} else {
spec.border
.map_or_else(|| ui.color(Role::OutlineVariant), |role| ui.color(role))