fix: 更换壁纸后背景不更新 #1

Open
ZV wants to merge 1 commits from fix/startup-white-screen into main
pull from: fix/startup-white-screen
Owner

BackgroundWidget 定义了静态 BackgroundWidget.spec 并对外暴露,
但组件内部从未 addListener 订阅它。设置页通过 Provider 更新壁纸后,
spec 的值确实变了,组件却收不到通知,既不重建也不重新加载,
界面一直停在旧图上。

BackgroundWidget 位于 MaterialApp.builder 内,路由跳转不会触发其
重建,因此必须依赖监听而非重建来响应变更。

补充 initState 中 addListener、dispose 中 removeListener。

BackgroundWidget 定义了静态 BackgroundWidget.spec 并对外暴露, 但组件内部从未 addListener 订阅它。设置页通过 Provider 更新壁纸后, spec 的值确实变了,组件却收不到通知,既不重建也不重新加载, 界面一直停在旧图上。 BackgroundWidget 位于 MaterialApp.builder 内,路由跳转不会触发其 重建,因此必须依赖监听而非重建来响应变更。 补充 initState 中 addListener、dispose 中 removeListener。
ZV added 1 commit 2026-11-22 09:24:28 +08:00
BackgroundWidget 定义了静态 BackgroundWidget.spec 并对外暴露,
但组件内部从未 addListener 订阅它。设置页通过 Provider 更新壁纸后,
spec 的值确实变了,组件却收不到通知,既不重建也不重新加载,
界面一直停在旧图上。

BackgroundWidget 位于 MaterialApp.builder 内,路由跳转不会触发其
重建,因此必须依赖监听而非重建来响应变更。

补充 initState 中 addListener、dispose 中 removeListener。
This pull request has changes conflicting with the target branch.
  • lib/core/widgets/background_widget.dart
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/startup-white-screen:fix/startup-white-screen
git checkout fix/startup-white-screen
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ZV/ZV-Manager#1