fix: 重构toast,修改UI设计并修复无宽度限制的问题 - #3515
Conversation
- TitleText MaxHeight 48→96,约 6 行 - 鼠标悬停 toast 时冻结进度条并停住隐藏倒计时,移出后按剩余时间续走;与拖拽互斥 - 重复触发强调动画改为三段回弹(-14/+18/-4),净位移归零
- Info 类型图标、楔形条、底部加载条改用主题色 ColorBrush2(动态跟随主题切换) - MyMsgBoxConverter 新增 HintType 字段,新增 MyMsgBoxByHintType 入口 - 点击 toast 展开的详情弹窗按提示类型显示图标与配色(Info 主题色,Error 标题与按钮变红)
- 滑出 200→150ms、淡出 150→110ms,消失更利落 - 新增 _hideStartsAtTick 记录倒计时终点:进入滑出阶段后悬停不再暂停, 杜绝停掉半途隐藏导致卡半透明、永不消失;MouseLeave 异常路径直接放行消失
- 标题与分割线颜色跟随图标(toast 类型色),仅 HintType 非空时生效;普通警告弹窗的红色标题不受影响 - 按钮区新增复制按钮,点击把正文写入剪贴板(复用 Common.Action.Copy)
- 按叠置次序淡化:最新 1.0,旧弹窗递减至 55% 下限,200ms 过渡 - 入场中/拖拽中/隐藏滑出中的弹窗淡化系统不介入,避免 Opacity 动画冲突 - 入场结束经 NotifyToastShown 复位并重新分层;Emphasize/拖拽中断入场时复位 IsEntering,防止淡化被永久跳过
- 复制按钮从底部右侧按钮组独立到左下,确认/取消按钮组保持右侧 - toast 文本 MaxHeight 96→32(2 行),长文本点击展开看详情 - 关闭按钮 20→26px,图标随按钮自适应放大
- RootGrid 挂 BlurEffect 模糊卡片内容,背景迁移到 RootGrid 一起模糊(8px 圆角裁剪) - 模糊与淡化同组联动:最新清晰,旧弹窗 BlurRadius 按叠置次序 5+i*4.5 递增、封顶 14 - ResetDimBlur 统一复位时机:隐藏滑出/拖拽/强调前清零,防止残留模糊
审阅者指南重构 Toast 通知系统,以支持叠放布局、鼠标悬停暂停、拖拽关闭,以及与详情对话框的联动,同时更新视觉设计并添加调试/测试钩子。 Toast 叠放与变暗生命周期的时序图sequenceDiagram
participant Timer
participant HintService
participant PanHint
participant MyToast
Timer->>HintService: Tick()
HintService->>PanHint: Children.Insert(0, toast)
HintService->>MyToast: Show()
MyToast->>HintService: NotifyToastShown(this)
HintService->>HintService: RearrangeToasts()
Note over HintService,MyToast: When limit reached
Timer->>HintService: Tick()
HintService->>PanHint: LastOrDefault(t)
HintService->>MyToast: Dismiss()
MyToast->>PanHint: Children.Remove(this)
MyToast->>HintService: OnToastRemoved(this)
HintService->>HintService: RearrangeToasts()
文件级变更
可能关联的问题
技巧与指令与 Sourcery 交互
自定义你的体验前往你的 控制面板:
获取帮助Original review guide in EnglishReviewer's GuideRefactors the toast notification system to support stacked layout, hover-pause, drag-close, and coordinated detail dialogs, while updating visual design and adding debug/testing hooks. Sequence diagram for toast stacking and dimming lifecyclesequenceDiagram
participant Timer
participant HintService
participant PanHint
participant MyToast
Timer->>HintService: Tick()
HintService->>PanHint: Children.Insert(0, toast)
HintService->>MyToast: Show()
MyToast->>HintService: NotifyToastShown(this)
HintService->>HintService: RearrangeToasts()
Note over HintService,MyToast: When limit reached
Timer->>HintService: Tick()
HintService->>PanHint: LastOrDefault(t)
HintService->>MyToast: Dismiss()
MyToast->>PanHint: Children.Remove(this)
MyToast->>HintService: OnToastRemoved(this)
HintService->>HintService: RearrangeToasts()
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - 我在这里给出了一些总体反馈:
_hideStartsAtTick标志位目前只会被设置,但当隐藏动画被取消时(例如在Emphasize、Dismiss、拖拽开始或鼠标悬停暂停时)从不会被清除,这可能导致IsHiding持续错误地为 true,从而阻塞变暗/悬停行为;建议在所有会停止隐藏动画的路径中将_hideStartsAtTick重置为 0。PageSetupLauncherMisc中的 toast 测试处理逻辑和 UI 虽然标记为仅用于调试,但目前仍被编译进主代码;建议将其包裹在明确的调试标志中,或者在合并前移除,以避免在生产构建中暴露内部测试入口。
提供给 AI Agents 的提示
请根据以下代码审查意见进行修改:
## 总体说明
- `_hideStartsAtTick` 标志位目前只会被设置,但当隐藏动画被取消时(例如在 `Emphasize`、`Dismiss`、拖拽开始或鼠标悬停暂停时)从不会被清除,这可能导致 `IsHiding` 持续错误地为 true,从而阻塞变暗/悬停行为;建议在所有会停止隐藏动画的路径中将 `_hideStartsAtTick` 重置为 0。
- `PageSetupLauncherMisc` 中的 toast 测试处理逻辑和 UI 虽然标记为仅用于调试,但目前仍被编译进主代码;建议将其包裹在明确的调试标志中,或者在合并前移除,以避免在生产构建中暴露内部测试入口。帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续评审。
Original comment in English
Hey - I've left some high level feedback:
- The
_hideStartsAtTickflag is only ever set and never cleared when hide animations are cancelled (e.g. inEmphasize,Dismiss, drag start, or hover pause), which can causeIsHidingto incorrectly remain true and block dimming/hover behavior; consider resetting_hideStartsAtTickto 0 in all paths that stop the hide animation. - The toast test handlers and UI in
PageSetupLauncherMiscare marked as debug-only but currently compiled into the main code; consider wrapping these in a clear debug flag or removing them before merge to avoid exposing internal test entry points in production builds.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `_hideStartsAtTick` flag is only ever set and never cleared when hide animations are cancelled (e.g. in `Emphasize`, `Dismiss`, drag start, or hover pause), which can cause `IsHiding` to incorrectly remain true and block dimming/hover behavior; consider resetting `_hideStartsAtTick` to 0 in all paths that stop the hide animation.
- The toast test handlers and UI in `PageSetupLauncherMisc` are marked as debug-only but currently compiled into the main code; consider wrapping these in a clear debug flag or removing them before merge to avoid exposing internal test entry points in production builds.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c9e58cdd4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| <svgIcon:SvgIcon Grid.Row="0" x:Name="ToastTypeIcon" Width="18" Height="18" | ||
| HorizontalAlignment="Left" VerticalAlignment="Top" Margin="7,4,0,0" | ||
| UseOriginalColor="False" StrokeThickness="0" /> | ||
| <TextBlock Grid.Row="0" FontSize="23" TextTrimming="None" | ||
| HorizontalAlignment="Left" Name="LabTitle" Margin="31,-1,70,9" Text="测试标题文本" |
There was a problem hiding this comment.
Preserve default styling for ordinary dialogs
When existing MyMsgBox(...) calls create a MyMsgText, HintType stays null, so the constructor never assigns ToastTypeIcon.Icon or LabTitle.Foreground. With this unconditional icon slot and the removed ColorBrush2 foreground, ordinary text dialogs now get an empty 18px title gap and the system text brush instead of the previous themed title/divider; keep the default foreground and collapse or omit the icon unless a hint type is supplied.
Useful? React with 👍 / 👎.
| if (_pauseStartedAtTick > 0 && TimeUtils.GetTimeTick() - _pauseStartedAtTick >= _hoverRemainingMs) | ||
| { | ||
| StartHideAnimation(0); | ||
| return; |
There was a problem hiding this comment.
Resume the paused timeout after hover
If a user keeps the pointer over a toast longer than _hoverRemainingMs, this branch hides it immediately on MouseLeave, even though MouseEnter stopped the hide animation and froze the progress bar at the saved remaining width. That makes hover fail to actually pause long enough for users to read a toast—the toast vanishes as soon as they move away instead of resuming the saved remaining time shown by the bar.
Useful? React with 👍 / 👎.
|
既然说的是 toast 为什么要修改 MyMsg? 除此之外你使用了大量的模糊效果,首先这会对性能造成影响,除此之外也并没有很好的去凸显信息,视觉上看起来也没有很好地优化。并且不是很理解为什么堆叠的 MyToast 要加模糊效果。 |
Chiloven945
left a comment
There was a problem hiding this comment.
请严格遵守 技术规范 重新修整你的 PR:
- PR 中的所有 Commit 必须要附带有效的、已验证的签名。参考 提交信息规范-提交签名要求 章节与 GPG 签名配置指南。
- 如果使用了任意 AI 工具,应该在 PR 提交信息或者 Commit 信息内注明使用的模型、工具信息等。参考 项目开发规范-AI 工具使用规范 章节。
关于凸显信息和性能优化上我会再进行进一步处理 |
我认为通过遮挡关系和透明度调整,已经能够明确主次地位,多层窗口+毛玻璃看着像散光() |
Emmmm,我修改下 |
概括
本次更新重构 Toast 提示系统:
注意
Important
包含debug用组件,确认合并前请@我删除相关无用代码
Summary by Sourcery
重构 toast 通知系统,以改进布局、堆叠方式和视觉层级,并让详情对话框与 toast 类型保持一致。
New Features:
Bug Fixes:
Enhancements:
Original summary in English
Summary by Sourcery
Refactor the toast notification system to improve layout, stacking, and visual hierarchy while aligning detail dialogs with toast types.
New Features:
Bug Fixes:
Enhancements: