mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: listener
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -44,22 +44,6 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
|
||||
length: tabs.length,
|
||||
vsync: this,
|
||||
);
|
||||
// 监听 tabController 切换
|
||||
// if (enableGradientBg) {
|
||||
// tabController.animation!.addListener(() {
|
||||
// if (tabController.indexIsChanging) {
|
||||
// if (initialIndex.value != tabController.index) {
|
||||
// initialIndex.value = tabController.index;
|
||||
// }
|
||||
// } else {
|
||||
// final int temp = tabController.animation!.value.round();
|
||||
// if (initialIndex.value != temp) {
|
||||
// initialIndex.value = temp;
|
||||
// tabController.index = initialIndex.value;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -36,28 +36,28 @@ class _ZonePageState extends State<ZonePage>
|
||||
super.initState();
|
||||
_zoneController =
|
||||
Get.put(ZoneController(zoneID: widget.rid), tag: widget.rid.toString());
|
||||
_zoneController.scrollController.addListener(listener);
|
||||
}
|
||||
|
||||
void listener() {
|
||||
StreamController<bool> mainStream =
|
||||
Get.find<MainController>().bottomBarStream;
|
||||
StreamController<bool> searchBarStream =
|
||||
Get.find<HomeController>().searchBarStream;
|
||||
_zoneController.scrollController.addListener(
|
||||
() {
|
||||
final ScrollDirection direction =
|
||||
_zoneController.scrollController.position.userScrollDirection;
|
||||
if (direction == ScrollDirection.forward) {
|
||||
mainStream.add(true);
|
||||
searchBarStream.add(true);
|
||||
} else if (direction == ScrollDirection.reverse) {
|
||||
mainStream.add(false);
|
||||
searchBarStream.add(false);
|
||||
}
|
||||
},
|
||||
);
|
||||
final ScrollDirection direction =
|
||||
_zoneController.scrollController.position.userScrollDirection;
|
||||
if (direction == ScrollDirection.forward) {
|
||||
mainStream.add(true);
|
||||
searchBarStream.add(true);
|
||||
} else if (direction == ScrollDirection.reverse) {
|
||||
mainStream.add(false);
|
||||
searchBarStream.add(false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_zoneController.scrollController.removeListener(() {});
|
||||
_zoneController.scrollController.removeListener(listener);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user