opt: 排行榜切换tab数据缓存

This commit is contained in:
guozhigq
2024-03-24 13:42:40 +08:00
parent 0f0546ae59
commit 77b509fd17
2 changed files with 9 additions and 3 deletions

View File

@ -9,7 +9,7 @@ import 'package:pilipala/utils/storage.dart';
class RankController extends GetxController with GetTickerProviderStateMixin {
bool flag = false;
late RxList tabs = [].obs;
RxInt initialIndex = 1.obs;
RxInt initialIndex = 0.obs;
late TabController tabController;
late List tabsCtrList;
late List<Widget> tabsPageList;

View File

@ -22,15 +22,20 @@ class ZonePage extends StatefulWidget {
State<ZonePage> createState() => _ZonePageState();
}
class _ZonePageState extends State<ZonePage> {
final ZoneController _zoneController = Get.put(ZoneController());
class _ZonePageState extends State<ZonePage>
with AutomaticKeepAliveClientMixin {
late ZoneController _zoneController;
List videoList = [];
Future? _futureBuilderFuture;
late ScrollController scrollController;
@override
bool get wantKeepAlive => true;
@override
void initState() {
super.initState();
_zoneController = Get.put(ZoneController(), tag: widget.rid.toString());
_futureBuilderFuture = _zoneController.queryRankFeed('init', widget.rid);
scrollController = _zoneController.scrollController;
StreamController<bool> mainStream =
@ -68,6 +73,7 @@ class _ZonePageState extends State<ZonePage> {
@override
Widget build(BuildContext context) {
super.build(context);
return RefreshIndicator(
onRefresh: () async {
return await _zoneController.onRefresh();