fix(ui): Phase 7 C3 修复 — AboutDialog 改用 Rectangle overlay + backdrop

原 AboutDialog inherits Slint Dialog(PopupWindow 子类)并 inline 实例化,没经过运行时 show(),close() 是空操作 → 用户点 Close 没反应、UI 卡死。\n- dialogs.slint:AboutDialog / ConfirmDialog 改为 inherits Rectangle,手写 backdrop(点击关闭)+ content card(Close 按钮调 close-dialog 回调)\n- app.slint:新增 show-about bool 属性;Sidebar About 点击同时触发 about-clicked + show-about=true;最外层 if root.show-about: AboutDialog 渲染\n- 删掉 selection==About 的右栏 marker(现在 About 是模态,不再需要)
This commit is contained in:
2026-09-19 19:40:16 +08:00
parent cd67fe9e8c
commit d2de452c53
2 changed files with 195 additions and 116 deletions
+30 -14
View File
@@ -53,6 +53,16 @@ export component MainWindow inherits Window {
in-out property <SidebarSelection> selection: SidebarSelection.All;
// ── Phase 7 C3 fix: AboutDialog overlay. The previous version
// inherited Slint's `Dialog` (a PopupWindow-derived type) and
// instantiated it inline; without a runtime `.show()` call,
// close() was a no-op and the Close button became inert. We
// now drive the dialog with a plain boolean (toggled from Rust)
// and render it as a manual Rectangle overlay in `if
// root.show-about: AboutDialog { … }`. See dialogs.slint. ──
in-out property <bool> show-about: false;
callback close-about();
// ── Phase 2 C2: mock messages + selection ────────────────────
in-out property <[MessageItem]> messages;
in-out property <int> selected-message-index: -1;
@@ -225,6 +235,13 @@ export component MainWindow inherits Window {
clicked => {
root.selection = SidebarSelection.About;
root.about-clicked();
// Phase 7 C3 fix: surface the (now
// Rectangle-overlay) About dialog. The
// Rust `about-clicked` callback still runs
// for telemetry; the actual show happens
// here so the dialog opens the moment the
// user clicks the nav row.
root.show-about = true;
}
}
}
@@ -415,21 +432,20 @@ export component MainWindow inherits Window {
}
}
// About entry stays as a simple right-pane marker; the
// modal AboutDialog overlay is wired through AboutDialog in
// this component (visibility toggled via `about-clicked`).
if root.selection == SidebarSelection.About: Rectangle {
background: bg;
Text {
x: 24px;
y: 24px;
text: "About — see the dialog.";
color: text-muted;
font-size: 13px;
}
}
// Phase 7 C3 fix: the About page is no longer a separate
// right-pane marker. Clicking the sidebar About row opens
// a modal dialog overlay (see `if root.show-about:
// AboutDialog { … }` further down), so there's nothing
// to show in the right pane for `selection == About`.
}
}
AboutDialog {}
// Phase 7 C3 fix: conditional About overlay driven by
// `show-about`. See the comment on the property above for why
// we no longer use Slint's `Dialog` type here.
if root.show-about: AboutDialog {
close-dialog => {
root.show-about = false;
}
}
}