Use PageStorage to store state

This commit is contained in:
2024-12-09 19:56:43 +08:00
parent 14fe901144
commit 4e121748cd
5 changed files with 188 additions and 79 deletions

View File

@@ -62,10 +62,18 @@ class _MainPageState extends State<MainPage> {
}
final _pages = [
const HomePage(),
const FavoritesPage(),
const ExplorePage(),
const CategoriesPage(),
const HomePage(
key: PageStorageKey('home'),
),
const FavoritesPage(
key: PageStorageKey('favorites'),
),
const ExplorePage(
key: PageStorageKey('explore'),
),
const CategoriesPage(
key: PageStorageKey('categories'),
),
];
var index = 0;