DingMouRen/flutter_tiktok

视频没有做缓存,每次切换都会初始化

TransFormes opened this issue · 2 comments

底部栏切换会导致首页销毁,视频实例也都销毁,在切换回来又初始化,假如是网络资源会更慢

You could update the getBody() method in main_page.dart file as below.

IndexedStack(
        index: _mainPageController.indexBottomBarMainPage.value,
        children: [
          HomePage(pageController: _scrollPageController),
          SearchPage(),
          MessagePage(),
          UserPage(
            pageController: _scrollPageController,
            isLoginUser: true,
            userModel: loginUserModel
          ),
        ],
      ),

这样就可以缓存了嘛?