Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify code #490

Merged
merged 1 commit into from
Dec 19, 2024
Merged

simplify code #490

merged 1 commit into from
Dec 19, 2024

Conversation

xxfttkx
Copy link
Contributor

@xxfttkx xxfttkx commented Dec 19, 2024

简化路由代码,另外能问一下使用手动notifyListeners();代替setState的原因吗

@Predidit
Copy link
Owner

感谢你的工作

notifyListeners(); 是和 Provider 搭配使用的, 这是 flutter 第一方提供的简易状态管理方案,用来在不同组件之间共享状态

这里用来实现移动设备上,在非 PopularPage 的状态下使用返回手势会返回 PopuarPage 并向 menu 发送通知,改变当前 selectedIndex 的UI状态, 这里用 MobX 有些太重了

setState 一般用在状态不共享的场合

@Predidit Predidit merged commit 0abc3b1 into Predidit:main Dec 19, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants