Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-02 10:36:29 +08:00
parent 05668912f6
commit b89b822d5e
3 changed files with 12 additions and 57 deletions

View File

@@ -17,7 +17,6 @@ import 'package:PiliPlus/utils/storage.dart';
import 'package:PiliPlus/utils/storage_key.dart';
import 'package:PiliPlus/utils/storage_pref.dart';
import 'package:collection/collection.dart';
import 'package:easy_debounce/easy_throttle.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -256,30 +255,24 @@ class MainController extends GetxController
if (value != selectedIndex.value) {
selectedIndex.value = value;
controller.jumpToPage(value);
if (currentNav == NavigationBarType.home) {
if (currentNav == .home) {
checkUnread();
} else if (currentNav == NavigationBarType.dynamics) {
} else if (currentNav == .dynamics) {
setDynCount();
}
} else {
int now = DateTime.now().millisecondsSinceEpoch;
if (now - _lastSelectTime < 500) {
EasyThrottle.throttle(
'topOrRefresh',
const Duration(milliseconds: 500),
() {
if (currentNav == NavigationBarType.home) {
homeController.onRefresh();
} else if (currentNav == NavigationBarType.dynamics) {
dynamicController.onRefresh();
}
},
);
if (currentNav == .home) {
homeController.onRefresh();
} else if (currentNav == .dynamics) {
dynamicController.onRefresh();
}
} else {
if (currentNav == NavigationBarType.home) {
homeController.toTopOrRefresh();
} else if (currentNav == NavigationBarType.dynamics) {
dynamicController.toTopOrRefresh();
if (currentNav == .home) {
homeController.animateToTop();
} else if (currentNav == .dynamics) {
dynamicController.animateToTop();
}
}
_lastSelectTime = now;