fix(app-iced): M116 r5 —— 圆角状态从「换色正文」升级成 tonal notice 容器
r5 复审的第二轮意见(改前那条是一行紫灰正文,与说明段只差色相、中间没有间距,读起来还是 「一段话的前两句」)。按 M3 惯例改成**容器**: - 新增 `pages/appearance/mod.rs::notice`:`Role::SurfaceContainerHighest` 底 + `ShapeScale::Small` 圆角 + 左右 `Space::X2` / 上下 `Space::X1` 内边距,文字 `Role::OnSurfaceVariant` + 加粗。**只用既有角色与间距档位**,不新增令牌、不引入图标。 (放在模块根而不是 `section.rs`:后者已 395 行,400 行是硬顶。) - 状态行与下面的说明段之间再补 `Space::X1`(列间距 X1 + 这里 X1 = X2 总量), 让它与说明段在**形态**上分开,而不是靠色相。 - 出现条件不变:仅「跟随系统 + α<1」;档位照常显示用户选的值。 - 像素实测(浅色 α=85,1180×760 / 100% DPI):容器底色 `(216,228,239)`、卡片底 `(235,245,255)`;容器内文字 `(58,72,83)`;容器 y=372..411,说明段首行 y=428 ⇒ ink 间距 16px(布局 8px + 行高留白);α=100 两张图该底色出现次数为 0。 门禁:fmt --check 0 / `cargo test -p unlucky-app-iced --lib -j 2` 0(475 passed)。
This commit is contained in:
1 parent
67deb103b0
commit
dc1fa8d082
2 files changed
+43
-9
No files matched your search
@@ -48,6 +48,18 @@
|
||||
//! 字节/属性值(不是观感),因为在 RDP + 虚拟显示适配器上「看上去多透明 / 圆不圆」不可信。
|
||||
//! 截图矩阵用 `ULL_APPEARANCE_*` 环境变量灌值(见 [`state`] 的常量)。
|
||||
|
||||
use iced::widget::container;
|
||||
use iced::{Background, Border, Element, Length, Padding};
|
||||
|
||||
use unlucky_design::color::Role;
|
||||
use unlucky_design::shape::ShapeScale;
|
||||
use unlucky_design::spacing::Space;
|
||||
use unlucky_design::typography::TypeRole;
|
||||
|
||||
use crate::pages::frame;
|
||||
use crate::pages::Message;
|
||||
use crate::theme::Ui;
|
||||
|
||||
pub mod alpha;
|
||||
pub mod background;
|
||||
|
||||
@@ -56,6 +68,31 @@ mod picture;
|
||||
mod section;
|
||||
mod state;
|
||||
|
||||
/// 状态提示的 **tonal notice**(`section.rs` 的 400 行硬顶把它放在模块根)。
|
||||
///
|
||||
/// `SurfaceContainerHighest` 底 + `ShapeScale::Small` 圆角 + 两侧 `X2` 内边距,文字 `OnSurfaceVariant`。
|
||||
/// 用它而不是「换色的正文」:容器才是 M3 表达「当前状态」的形态,也和说明段在**形态**上分开
|
||||
/// (不靠色相、不新增令牌)。调用点见 [`section::section`] 的圆角一节。
|
||||
fn notice<'a>(ui: &'a Ui, text: &str) -> Element<'a, Message> {
|
||||
let background = ui.color(Role::SurfaceContainerHighest);
|
||||
let tone = ui.color(Role::OnSurfaceVariant);
|
||||
let body = frame::text_role_owned(ui, TypeRole::BodySmall, true, text.to_owned(), tone);
|
||||
let pad = ui.space(Space::X2);
|
||||
let radius = ui.radius_dp(ShapeScale::Small);
|
||||
container(body)
|
||||
.width(Length::Fill)
|
||||
.padding(Padding::from([ui.space(Space::X1), pad]))
|
||||
.style(move |_theme| container::Style {
|
||||
background: Some(Background::Color(background)),
|
||||
border: Border {
|
||||
radius,
|
||||
..Border::default()
|
||||
},
|
||||
..container::Style::default()
|
||||
})
|
||||
.into()
|
||||
}
|
||||
|
||||
pub use picture::layer;
|
||||
pub use section::section;
|
||||
pub use state::State;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
//! CPU 档下面板 α 被强制 1.0(D36),而用户请求值可能是 0.5。滑块位置按**生效值**画、旁边写
|
||||
//! 「requested 0.50 → forced 1.00」,这样「为什么拖了没反应」在界面上就有答案,而不是只躺在日志里。
|
||||
|
||||
use iced::widget::{button, column, container, row};
|
||||
use iced::widget::{button, column, container, row, space};
|
||||
use iced::{
|
||||
Alignment, Background, Border, Color, Element, Length, Padding, Shadow, Theme as IcedTheme,
|
||||
};
|
||||
@@ -88,9 +88,12 @@ pub fn section<'a>(ui: &'a Ui, state: &'a State) -> Element<'a, Message> {
|
||||
),
|
||||
],
|
||||
));
|
||||
// 状态行(r5 P2-1):只在「跟随系统 + α<1」出现;Tertiary + 加粗,与下面的说明段刻意不同形。
|
||||
// **tonal notice**(r5 视觉终稿):M3 里表达「当前状态」的惯用形态是**容器**,不是改字色。
|
||||
// 只在「跟随系统 + α<1」出现;与下面的说明段之间再留 `Space::X1`(列间距 X1 + 这里 X1 = X2)。
|
||||
if corner == WindowCorner::System && state.window_opacity < 1.0 {
|
||||
rows = rows.push(state_line(ui, t(Key::SettingsAppearanceCornerSuspended)));
|
||||
rows = rows.push(super::notice(ui, t(Key::SettingsAppearanceCornerSuspended)));
|
||||
let gap: Element<'a, Message> = space::vertical().height(ui.space(Space::X1)).into();
|
||||
rows = rows.push(gap);
|
||||
}
|
||||
let tone = ui.color(Role::OnSurfaceVariant);
|
||||
rows = rows.push(note_line(ui, t(Key::SettingsAppearanceCornerHint), tone));
|
||||
@@ -281,12 +284,6 @@ fn note_line<'a>(ui: &'a Ui, content: &str, color: Color) -> Element<'a, Message
|
||||
frame::text_role_owned(ui, TypeRole::BodySmall, false, content.to_owned(), color)
|
||||
}
|
||||
|
||||
/// 状态行(r5 P2-1):与说明段刻意不同形——`Role::Tertiary` + 强调字重,让「当前不生效」被当成状态看见。
|
||||
fn state_line<'a>(ui: &'a Ui, text: &str) -> Element<'a, Message> {
|
||||
let tone = ui.color(Role::Tertiary);
|
||||
frame::text_role_owned(ui, TypeRole::BodySmall, true, text.to_owned(), tone)
|
||||
}
|
||||
|
||||
/// 一行「标签 + 值 + 滑块 + 说明」。
|
||||
fn slider_row<'a>(
|
||||
ui: &'a Ui,
|
||||
|
||||
Reference in new issue
Block a user