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

The position state cannot be restored when you use Navigator.of(context).pop(); #326

Open
BlackTryyy opened this issue Nov 6, 2023 · 2 comments

Comments

@BlackTryyy
Copy link

flutter version : 3.1.0

I'm using easy_refresh: ^3.3.2+2 to wrap a

flutter_staggered_grid_view: ^0.7.0

so that when I slide down to load new content, I click

Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>

, then Navigator.of(context).pop(); When you come back, the location information of the previous page is lost

b39c0d315cb5cb8d0aec557b58bbd4f4.mp4
@bing127
Copy link

bing127 commented Nov 8, 2023

Flutter 版本:3.1.0

我用来包装一个 easy_refresh: ^3.3.2+2

flutter_staggered_grid_view: ^0.7.0

这样当我向下滑动以加载新内容时,我单击

Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>

,则当您返回时,上一页的位置信息将丢失Navigator.of(context).pop();

b39c0d315cb5cb8d0aec557b58bbd4f4.mp4

您这个问题应该不是该组件的原因,而是你列表页面需要添加AutomaticKeepAliveClientMixin

@BlackTryyy
Copy link
Author

BlackTryyy commented Nov 13, 2023

Flutter 版本:3.1.0
我用来包装一个 easy_refresh: ^3.3.2+2
flutter_staggered_grid_view: ^0.7.0
这样当我向下滑动以加载新内容时,我单击

Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>

,则当您返回时,上一页的位置信息将丢失Navigator.of(context).pop();
b39c0d315cb5cb8d0aec557b58bbd4f4.mp4

您这个问题应该不是该组件的原因,而是你列表页面需要添加AutomaticKeepAliveClientMixin

我列表里面添加了AutomaticKeepAliveClientMixin,我认为即使没有添加AutomaticKeepAliveClientMixin,在pop出来之后,依然会保存有context的内容,这个方案在我其他页面没有使用该组件,但是其他保持一致的情况下(同样使用AutomaticKeepAliveClientMixin和Navigator.of(context).pop()以及easy_refresh)得到了印证,我觉得是当前的组件在load几次之后让滑动位置丢失或者错乱了

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