0

问题:我正在使用 bottomAppBar 来托管 4 个带有 ListViews 的选项卡。但是,每次我来回导航时,滚动位置都会重置。我需要它来保存用户的滚动位置。

我知道您可以在 TabBarView 中使用 PageStorageKey,但我想知道是否有 bottomAppBar 的等效方法。

我正在使用的代码:https ://medium.com/coding-with-flutter/flutter-bottomappbar-navigation-with-fab-8b962bb55013

谢谢!

4

1 回答 1

0

PageStorageKey 将是最简单的方法。

为了让 Listview 做同样的事情,将每个 listView 的偏移量存储在 mainPage 中,然后每次更改页面时,使用 listview 中指向存储偏移量的滚动控制器重建页面。

于 2019-02-20T02:00:42.783 回答