fix(app-iced): M95 r1 五条视觉复审(悬挂缩进 / 会话身份 / 摘要可见 / 贴底 / 描边)

- P2-1 **悬挂缩进真做了**(之前文档在骗人,代码里只有 `row![bar, text]`):
  每行拆「前缀 + 正文」两个文本控件(前缀 = 第一个空格及其之前,含空格;
  `split_prefix` 在第一个「词」>20 字符时不拆),正文带 Fill 宽度自己折行 ⇒
  续行落在前缀宽度之后。于是 `at com.mojang…(GLX.java:64)` 不再拆成「`at` 独占一行」。
  文档同步写清代价:续行缩进量 = 该行前缀宽度。
- P2-2 会话身份上页头:`Logs::with_status(lang)` 用 `LogsStatus` 模板拼
  `{instance} · {when} · {outcome}`,结局文案走 `LaunchOutcomeNormal/Crash/Silent`
  三 key(bridge 文档里那条「LogOutcome 三态 → 三 key」的结构化出口,此前 UI 侧零调用点)。
  中文模板差在全角竖线(守卫要求 zh≠en,也确实更符合中文排版)。
- P2-3 摘要钉成诊断卡**固定页脚**(不进滚动区):「One-line summary」+ Copy summary
  紧邻它要复制的那段等宽文本;卡片头不再放复制按钮(避免两处入口)。
- P2-4 日志卡改 `panel::scroll_tail`(`Anchor::End`):偏移按「距底多远」记,内容增长时
  跟随尾部;「用户上滚后是否冻结」的边界写在 `panel::scroll_tail` 文档里(结论:不冻结,
  冻结要 app 层回灌滚动状态,已登记)。
- P2-5 两张主卡补 1px 描边:`panel::card` 改用 `Component::OutlinedCard.spec().shape` +
  `ui.outlined(..)`,与 `frame::card` 同一套令牌。

测试:新增 `a_line_is_split_into_prefix_and_body_for_the_hanging_indent`(含 CJK 行与
「不拆」的两种边界)与 `status_line_names_the_session_with_the_launch_outcome_keys`;
key 清单补 `LogsStatus` 与三个 `LaunchOutcome*`;demo 的 state.build 改为收 `Lang`。

验证:`fmt --check` 通过;`clippy -p unlucky-app-iced --all-targets -D warnings` 干净;
`test -p unlucky-app-iced` 274+6 全绿、`-p unlucky-i18n` 23 全绿。
图:`.screens/logs-{empty,live,crash}-{light,dark}.png`(1180×760)、
`r2-live-tall-light.png`(1180×1080,栈帧可见,P2-1 证据)。
This commit is contained in:
AskaEth committed 2026-11-02 22:26:59 +08:00
1 parent 063a1dba39
commit 1bccf89e5c
10 files changed
+293 -93

No files matched your search

+37 -11
View File
@@ -16,40 +16,61 @@
//! 两者都是**兄弟**滚动区(不是嵌套):滚轮归属清楚,不存在「滚动条套滚动条」。
use iced::widget::{container, scrollable};
use iced::{Background, Border, Element, Length};
use iced::{Background, Element, Length};
use unlucky_design::component_map::Component;
use unlucky_design::elevation::MaterialLayer;
use unlucky_design::shape::ShapeScale;
use crate::theme::Ui;
use super::super::frame;
use super::super::Message;
/// 定高卡片(`Card` 材质层 + `OutlinedCard` 形状,令牌与 `frame::card` 同源)。
/// 定高卡片(`Card` 材质层 + `OutlinedCard` 形状与 **1px 描边**,与 `frame::card` 同一套令牌:
/// 实例页 / 下载页的卡都带这条描边,日志页的两张主卡不能例外)。
pub fn card<'a>(
ui: &'a Ui,
height: Length,
content: impl Into<Element<'a, Message>>,
) -> Element<'a, Message> {
let shape = Component::OutlinedCard.spec().shape;
container(content)
.width(Length::Fill)
.height(height)
.padding(ui.metrics().card_padding)
.style(move |_theme| container::Style {
background: Some(Background::Color(ui.layer(MaterialLayer::Card))),
border: Border {
radius: ui.radius_dp(ShapeScale::Large),
..Border::default()
},
border: ui.outlined(shape),
..container::Style::default()
})
.into()
}
/// 卡片内的竖向滚动区(滚条样式与实例页列表列同源)。
/// 卡片内的竖向滚动区(贴顶:诊断卡从头读)。
pub fn scroll<'a>(ui: &'a Ui, content: impl Into<Element<'a, Message>>) -> Element<'a, Message> {
scrollable(content)
scroller(ui, content, false)
}
/// 卡片内的竖向滚动区(**贴底**:日志卡看最后几行)。
///
/// `anchor_bottom` = `Anchor::End`:滚动偏移按「距底多远」记,所以**内容增长时视图保持在
/// 距底同一位置 ⇒ 天然跟随尾部**。用户上滚后偏移 = 距底 N 像素,新内容到达时仍按「距底 N」
/// 呈现(视图跟着内容下移),也就是说**这里没有「上滚即冻结」**——那需要页面自己持有滚动
/// 状态 + `on_scroll` 消息 + app 层回灌,属于另一件事(已登记在报告里)。
pub fn scroll_tail<'a>(
ui: &'a Ui,
content: impl Into<Element<'a, Message>>,
) -> Element<'a, Message> {
scroller(ui, content, true)
}
fn scroller<'a>(
ui: &'a Ui,
content: impl Into<Element<'a, Message>>,
tail: bool,
) -> Element<'a, Message> {
let view = scrollable(content)
.direction(scrollable::Direction::Vertical(
scrollable::Scrollbar::new()
.width(frame::SCROLLBAR_WIDTH)
@@ -58,6 +79,11 @@ pub fn scroll<'a>(ui: &'a Ui, content: impl Into<Element<'a, Message>>) -> Eleme
))
.height(Length::Fill)
.width(Length::Fill)
.style(frame::scroll_style(ui))
.into()
.style(frame::scroll_style(ui));
if tail {
view.anchor_bottom().into()
} else {
view.into()
}
}