preserve state on tab change
This commit is contained in:
parent
d99492d6cb
commit
cc7da5a045
|
@ -76,11 +76,6 @@ class MyHomePage extends HookWidget {
|
||||||
UserProfileTab(),
|
UserProfileTab(),
|
||||||
];
|
];
|
||||||
|
|
||||||
// TODO: does this even work? the state seems to be popped
|
|
||||||
// for example: go to user tab, wait for it to load,
|
|
||||||
// go to a different tab, go back, the data is loading again
|
|
||||||
final PageStorageBucket pageStorageBucket = PageStorageBucket();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
@ -109,9 +104,10 @@ class MyHomePage extends HookWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: PageStorage(
|
extendBody: true,
|
||||||
bucket: pageStorageBucket,
|
body: IndexedStack(
|
||||||
child: pages[currentTab.value],
|
index: currentTab.value,
|
||||||
|
children: pages,
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
child: Icon(Icons.add),
|
child: Icon(Icons.add),
|
||||||
|
|
Loading…
Reference in New Issue