mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: refresh on top (#524)
* feat: refresh on top * check ctr client Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
7a6085e923
commit
a74edd22c1
@@ -1,9 +1,13 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:PiliPlus/pages/common/common_controller.dart';
|
||||
import 'package:PiliPlus/pages/rank/zone/index.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/models/common/rank_type.dart';
|
||||
|
||||
class RankController extends GetxController with GetTickerProviderStateMixin {
|
||||
class RankController extends GetxController
|
||||
with GetTickerProviderStateMixin, ScrollOrRefreshMixin {
|
||||
bool flag = false;
|
||||
late RxList tabs = [].obs;
|
||||
RxInt initialIndex = 0.obs;
|
||||
@@ -13,6 +17,12 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
|
||||
// StreamController<bool>.broadcast();
|
||||
late bool enableGradientBg;
|
||||
|
||||
ZoneController get controller => Get.find<ZoneController>(
|
||||
tag: tabsConfig[tabController.index]['rid'].toString());
|
||||
|
||||
@override
|
||||
ScrollController get scrollController => controller.scrollController;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
@@ -22,18 +32,6 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
|
||||
setTabConfig();
|
||||
}
|
||||
|
||||
void onRefresh() {
|
||||
int index = tabController.index;
|
||||
Get.find<ZoneController>(tag: tabsConfig[index]['rid'].toString())
|
||||
.onRefresh();
|
||||
}
|
||||
|
||||
void animateToTop() {
|
||||
int index = tabController.index;
|
||||
Get.find<ZoneController>(tag: tabsConfig[index]['rid'].toString())
|
||||
.animateToTop();
|
||||
}
|
||||
|
||||
void setTabConfig() async {
|
||||
tabs.value = tabsConfig;
|
||||
initialIndex.value = 0;
|
||||
@@ -51,4 +49,7 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
|
||||
tabController.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> onRefresh() => controller.onRefresh();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user