简体   繁体   English

如何记住浏览量小部件上次访问的页面

[英]How To Remember Pageview Widget Last Visited Page

I am building an Android App using Flutter and Dart.我正在使用 Flutter 和 Dart 构建一个 Android 应用程序。

In this app, I am using a Pageview Widget, the user interact with it, scroll some pages, now when the user leaves the Pageview Widget and go to some other page do some activity there, the user when comes back to the Pageview Widget, the widget starts showing the dynamically created pages, it starts with the first page, here I want to start the index from the page which was last visited by the user.在这个应用程序中,我使用的是 Pageview Widget,用户与其交互,滚动一些页面,现在当用户离开 Pageview Widget 并转到其他页面时,在那里做一些活动,当用户回到 Pageview Widget 时,小部件开始显示动态创建的页面,它从第一页开始,在这里我想从用户上次访问的页面开始索引。

I have thought of a solution to store the last visited page on DB and retrieving it when the user comes to Pageview Widget and updating it on every page scroll.我想到了一个解决方案,将最后访问的页面存储在 DB 上,并在用户访问 Pageview Widget 时检索它并在每个页面滚动时更新它。 Is this a good solution?这是一个很好的解决方案吗? Or there is another way to accomplish this thing.或者有另一种方法来完成这件事。

最好的解决方案是将当前页面 id 保存在 shared_preferences 中,然后在用户再次访问该页面时检索它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter 中 PageView 小部件上的两个页面 - Two page on PageView widget in Flutter 如何将PageView正常从最后一页动画到第一页 - How to animate PageView normal from last page to first one Flutter:如何跳转到在 PageView 上动态创建的最后一页 - Flutter: How to jump to last page dynamically created on a PageView 如何让我在 PageView 中创建的按钮切换到最后一页的新页面? - How do I get the button I created in PageView to switch to a new page on the last page? 如何根据屏幕特征确定可以适合 PageView 小部件的每个页面(子页面)的文本量? - How to determine the amount of text that could fit on each page(child) of PageView widget, according to screen characteristics? 如果没有数据,如何在网页浏览中禁用小部件 - how to disable a widget inside a pageview if there is no data 如何使用 flutter 中的 pageView 动画交叉淡入淡出多个小部件? - How to AnimatedCrossFade multiple widget with the pageView in flutter? 如何在 PageView 中的小部件之间共享数据? - How share data between widget in PageView? 如何在 PageView 小部件中更改 FloatingActionButton 的颜色? - How to change color of FloatingActionButton in a PageView widget? 从页面视图容器小部件外部导航到 PageView 中的页面 - Navigae to a page in PageView from outside the page-view container widget
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM