mod: 控制器监听事件移除

This commit is contained in:
guozhigq
2023-08-20 09:12:31 +08:00
parent 6bbbdd7710
commit 8627869309
16 changed files with 114 additions and 31 deletions

View File

@ -34,6 +34,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
late VideoReplyController _videoReplyController;
late AnimationController fabAnimationCtr;
late ScrollController scrollController;
Future? _futureBuilderFuture;
bool _isFabVisible = true;
@ -61,18 +62,18 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
vsync: this, duration: const Duration(milliseconds: 300));
_futureBuilderFuture = _videoReplyController.queryReplyList();
_videoReplyController.scrollController.addListener(
scrollController = _videoReplyController.scrollController;
scrollController.addListener(
() {
if (_videoReplyController.scrollController.position.pixels >=
_videoReplyController.scrollController.position.maxScrollExtent -
300) {
if (scrollController.position.pixels >=
scrollController.position.maxScrollExtent - 300) {
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
_videoReplyController.onLoad();
});
}
final ScrollDirection direction =
_videoReplyController.scrollController.position.userScrollDirection;
scrollController.position.userScrollDirection;
if (direction == ScrollDirection.forward) {
_showFab();
} else if (direction == ScrollDirection.reverse) {
@ -113,7 +114,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
void dispose() {
super.dispose();
fabAnimationCtr.dispose();
_videoReplyController.scrollController.dispose();
scrollController.dispose();
}
@override