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

关于HomePage页状态保持的问题 #21

Open
wbingz0719 opened this issue Aug 20, 2019 · 6 comments
Open

关于HomePage页状态保持的问题 #21

wbingz0719 opened this issue Aug 20, 2019 · 6 comments

Comments

@wbingz0719
Copy link

遇到一个非常奇怪的问题,我在HomePage的build方法中返回自己的一个UI布局,在布局中有个点击事件,跳转到下一个页面。过程:进入首页,点击首页中的按钮跳转到下一个页面,再返回到首页,这时候切换底部导航栏的另外一个tab,再返回来,HomePage就丢失了状态(重新执行了initState方法)。其它的地方全都没改动,只是在HomePage中返回自定义的UI布局,而楼主的自己的UI布局是没有这个问题的,请问一下楼主在这个HomePage的状态保持是不是有特殊的处理?或者对于这个问题有没有什么处理办法?

@fg2q1q3q
Copy link

谁的initState,homepage还是你自己ui的?

@wbingz0719
Copy link
Author

homepage的,自己的UI只是在homepage的build里实现的简单的布局

@fg2q1q3q
Copy link

猜测可能跟globalkey有关

@wbingz0719
Copy link
Author

但是将你项目中GlobalKey干掉了也还是没问题

@fg2q1q3q
Copy link

这个触发条件应该就是二级页面,多试试二级页面

@wbingz0719
Copy link
Author

你说的二级页面是指在homepage中点击跳转后的页面吗?这个页面没什么内容的,并且两种情况跳转都是一样的,使用你项目的UI和我自己的UI跳转过去,都是同等条件

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

No branches or pull requests

2 participants