Skip to content

Commit

Permalink
opt: 排行榜切换tab数据缓存
Browse files Browse the repository at this point in the history
  • Loading branch information
guozhigq committed Mar 24, 2024
1 parent 4db5a95 commit 031d57e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/pages/rank/controller.dart
Expand Up @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions lib/pages/rank/zone/view.dart
Expand Up @@ -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 =
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 031d57e

Please sign in to comment.