From b563c6ac446cf0bdc2495553770dca881b9a74ba Mon Sep 17 00:00:00 2001 From: AskaEth Date: Mon, 2 Nov 2026 03:48:29 +0800 Subject: [PATCH] =?UTF-8?q?docs(app-iced):=20M75=20r5=20=E2=80=94=E2=80=94?= =?UTF-8?q?=20=E4=B8=89=E5=A4=84=E8=BF=87=E6=9C=9F=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E6=8C=89=20A1=20=E6=9B=B4=E6=AD=A3=EF=BC=88=E4=BC=9A=E8=A2=AB?= =?UTF-8?q?=E5=9B=9B=E6=9D=A1=E5=AE=B6=E6=97=8F=E7=BA=BF=E5=BD=93=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E6=8A=84=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - buttons/mod.rs 表行 1.8:禁用内容角色「按变体」(Variant::disabled_content),容器 α 注明 A1 是 10% - buttons/mod.rs 表行 2.7:IconButton 禁用内容 = OnSurface@38%(A1),落点改到 disabled_content_over_role - interaction α 表 / disabled_colors 文档:容器 0.12 与 A1 的 0.10f 差异点名 D8;内容默认为 OnSurfaceVariant - overlay_color 的 content 说明从 OnSurface 改成 OnSurfaceVariant(与 A1 一致) --- crates/app-iced/src/components/buttons/mod.rs | 4 ++-- crates/app-iced/src/components/interaction/mod.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/app-iced/src/components/buttons/mod.rs b/crates/app-iced/src/components/buttons/mod.rs index b852647..fe3561b 100644 --- a/crates/app-iced/src/components/buttons/mod.rs +++ b/crates/app-iced/src/components/buttons/mod.rs @@ -11,12 +11,12 @@ //! | 1.5 | 字级 | **LabelLarge 14/20 w500** | `TypeRole::LabelLarge` 强调档 | //! | 1.6 | 图标 18 + 图标↔文字 8 | 图标见 **G14 偏离**(令牌只有 16);间距 `Space::X2` | [`Geometry`] | //! | 1.7 | 最小宽 58 | **G15**:iced 的 `Length` 无 min-width,不施加(实测见报告) | — | -//! | 1.8 | 状态层 + 禁用 | hover 8 / focus 10 / pressed 10;容器 12% & 内容 38% | [`super::interaction`] | +//! | 1.8 | 状态层 + 禁用 | hover 8 / focus 10 / pressed 10;容器 12%(A1 是 10%,D8)& 内容 38%;**内容角色按变体**([`Variant::disabled_content`]) | [`super::interaction`] | //! | 1.9 | 五式色彩角色 | Filled `Primary`/`OnPrimary`;Tonal `SecondaryContainer`/`OnSecondaryContainer`;Elevated `SurfaceContainerLow`/`Primary`;Outlined 透明 + 1dp `OutlineVariant` + `OnSurfaceVariant`;Text 透明 + `OnSurfaceVariant` | [`Variant::roles`] | //! | 2.1 | IconButton 容器 | **40×40**、圆角 full | [`IconGeometry`] | //! | 2.2 | IconButton 图标 / 边距 | 图标 **24**、边距 **8** | [`IconGeometry`] | //! | 2.4 | Standard 各态**图标色不变** | 只有状态层变化 | [`Variant::roles`] 与态无关 | -//! | 2.7 | IconButton 禁用 | 内容 `OnSurface`@38% | [`super::interaction::disabled_colors`] | +//! | 2.7 | IconButton 禁用 | 内容 **`OnSurface`@38%**(A1;见 [`IconVariant::disabled_content`]) | [`super::interaction::disabled_content_over_role`] | //! | 2.8 | 命中区 | 容器 40 + 四周各 4 = **48** | `LM.touch_target`(按钮自身不撑高) | //! //! ## 与契约 §2 的签名差异(**已登记,请 tower 确认**) diff --git a/crates/app-iced/src/components/interaction/mod.rs b/crates/app-iced/src/components/interaction/mod.rs index 897885f..6cf7b8e 100644 --- a/crates/app-iced/src/components/interaction/mod.rs +++ b/crates/app-iced/src/components/interaction/mod.rs @@ -13,7 +13,7 @@ //! | focus | 0.10 | [`StateLayer::Focus`] | //! | pressed | 0.10 | [`StateLayer::Pressed`] | //! | dragged | 0.16 | [`StateLayer::Dragged`](按钮家族不用,列表拖拽用) | -//! | disabled 容器 | 0.12 | [`DISABLED_CONTAINER_ALPHA`](A1 是 0.10,差异登记 D8) | +//! | disabled 容器 | 0.12 | [`DISABLED_CONTAINER_ALPHA`](**A1 是 0.10f**,本文件按令牌 0.12,差异登记 D8) | //! | disabled 内容 | 0.38 | [`DISABLED_CONTENT_ALPHA`] | //! //! 上表右列是**唯一**允许的取值口;左列只是给人看的,代码里一个数字都不许出现 @@ -118,7 +118,7 @@ impl Interaction { /// 当前态叠在 `container` 上的**不透明**颜色;`None` = 该态不叠。 /// -/// `content` 是容器上的前景角色(Filled 按钮用 `OnPrimary`,中性表面上的控件用 `OnSurface`)。 +/// `content` 是容器上的前景角色(Filled 按钮用 `OnPrimary`;中性表面上的控件用 `OnSurfaceVariant`)。 pub fn overlay_color(ui: &Ui, state: Interaction, content: Role, container: Role) -> Option { state .layer() @@ -155,8 +155,8 @@ pub fn disabled_content_over_role(ui: &Ui, role: Role, on_container: bool) -> Co /// 禁用态的一对颜色 `(容器, 内容)`,内容按令牌口径叠在**算好的容器**之上。 /// -/// - 容器 = `OnSurface` @ 12%([`DISABLED_CONTAINER_ALPHA`])叠在 `surface` 上; -/// - 内容 = `OnSurfaceVariant` @ 38%(A1:`FilledButtonTokens.DisabledLabelTextColor`)叠在容器上。 +/// - 容器 = `OnSurface` @ 12%([`DISABLED_CONTAINER_ALPHA`];A1 是 0.10f,见 D8)叠在 `surface` 上; +/// - 内容 = **默认** `OnSurfaceVariant` @ 38%;按变体的取值走 [`disabled_content_over_role`]。 /// /// `ui` 不暴露 [`Scheme`],这里按同一个 flavor 求一次基线方案——调的是 /// `unlucky_design` 的**同一个**函数与同一套角色,不是第二份令牌。