fix(app-iced): M102 页面几何 —— 正文块贴左吃满页宽、列表末行不再被裁半行、日志按词断行
① 正文列与页头不对齐(下载 / 日志):根因是 `frame::single_column` 把**行宽上限 424** 当成**整页块宽度**并水平居中(1180 下 1044 里只摆 424,左缘 422 对页头标题 112)。 现在两个量分开:`layout` 的 `column` 只管成段散文(≤424),页面块宽走新的 `frame::body_width`(= available / main_pane)。新增 `frame::body`(贴左吃满)与 `frame::prose`(散文锁 424)。1180×760 下下载 / 日志的块左缘 = 112 = 页头标题左缘。 ② 实例列表末行被裁半行:页级行距 `Space::X1`(4) 让行节奏变成 64、与可视高度除不尽, 且滚动区直贴卡片 1px 圆角描边。行距归零(下载页同改)+ 滚动区底部内缩 `Space::X2`(8) ⇒ 可视区 580−32−8 = 540 = 9×60,Redstone Lab 及其副标题完整可见,第 10 行整体在裁切线外。 ③ 日志断行把单词劈开(`graphics.gl_o` / `peration_failure`):新增 `layout::wrap::breakable`,在 `.` `_` `:` `/` `\` 后插零宽空格(U+200B 软断点), 日志行正文与一行摘要都过它;悬挂缩进不变(前缀仍是独立文本控件), `Line::text` 与 `Logs::summary()`(剪贴板)仍是原文。工具函数放 `pages/layout/`: 断点是「列宽之后」的另一半排版判据,纯函数、可单测、不碰控件树。 护栏:`body_block_starts_at_the_header_title_and_fills_the_page`、 `list_viewport_fits_whole_rows_and_still_overflow`(把 580/32/8/540/60 五个数钉住)、 `wrap::tests`(断点位置 / 不重复插 / 可还原 / 幂等)、`log_text_carries_soft_breaks_but_keeps_the_original`。 `download/tests.rs` 的「宽窗留白」口径按新分工改成「宽度归块、不归散文列」。
This commit is contained in:
1 parent
8574d6ba2d
commit
89d98184c1
15 files changed
+466
-53
No files matched your search
@@ -40,7 +40,7 @@ pub(super) fn detail_column<'a>(
|
||||
.spacing(ui.space(Space::X4))
|
||||
.width(Length::Fill);
|
||||
|
||||
body = push_text(ui, body, detail);
|
||||
body = push_text(ui, metrics, body, detail);
|
||||
|
||||
// 页头 + 元信息网格 + **一条**分隔线以下才是正文与操作区(M84 那两条线是占位时期的排版残留)
|
||||
frame::left_aligned(metrics.column, body.push(action_row(ui, forced)))
|
||||
@@ -70,7 +70,7 @@ pub(super) fn narrow_detail<'a>(
|
||||
.spacing(ui.space(Space::X4))
|
||||
.width(Length::Fill);
|
||||
|
||||
body = push_text(ui, body, detail);
|
||||
body = push_text(ui, metrics, body, detail);
|
||||
|
||||
body = body.push(frame::text_role(
|
||||
ui,
|
||||
@@ -81,22 +81,29 @@ pub(super) fn narrow_detail<'a>(
|
||||
ui.color(Role::OnSurfaceVariant),
|
||||
));
|
||||
|
||||
frame::single_column(metrics, body.push(action_row(ui, forced)))
|
||||
frame::body(metrics, body.push(action_row(ui, forced)))
|
||||
}
|
||||
|
||||
/// 正文段(演示数据才有)与运行状态行(真数据才有)——两者都是可选的,顺序固定。
|
||||
///
|
||||
/// 散文段套 [`frame::prose`]:M102 起页面块吃满页宽,但「一行 ≤72 字符」的承诺仍然只由
|
||||
/// 散文承担(`frame::body_width` 管块、`metrics.column` 管一句话)。
|
||||
fn push_text<'a>(
|
||||
ui: &'a Ui,
|
||||
metrics: FrameMetrics,
|
||||
mut body: iced::widget::Column<'a, Message>,
|
||||
detail: &'a Detail,
|
||||
) -> iced::widget::Column<'a, Message> {
|
||||
if let Some(note) = &detail.note {
|
||||
body = body.push(frame::text_role(
|
||||
ui,
|
||||
TypeRole::BodyMedium,
|
||||
false,
|
||||
note.as_str(),
|
||||
ui.color(Role::OnSurfaceVariant),
|
||||
body = body.push(frame::prose(
|
||||
metrics,
|
||||
frame::text_role(
|
||||
ui,
|
||||
TypeRole::BodyMedium,
|
||||
false,
|
||||
note.as_str(),
|
||||
ui.color(Role::OnSurfaceVariant),
|
||||
),
|
||||
));
|
||||
}
|
||||
if let Some(status) = &detail.status {
|
||||
|
||||
Reference in new issue
Block a user