From 03f66febe5cb5229008ef80b27175e7cc1177bc0 Mon Sep 17 00:00:00 2001 From: fmk Date: Tue, 19 Apr 2022 10:22:07 +0800 Subject: [PATCH] =?UTF-8?q?ios=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/community_page.dart | 2 +- lib/community/headlines/article_page.dart | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index 68f145ea..5427554b 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -127,7 +127,7 @@ class _CommunityPage extends State if (e == "关于回乡") { return BrandPage(); }else if(e == "了解健康"){ - return ArticlePage(); + return ArticlePage(onChildScroll); }else if(e == "学习健康"){ return CommunityCourse(); } diff --git a/lib/community/headlines/article_page.dart b/lib/community/headlines/article_page.dart index a9749de4..355fb429 100644 --- a/lib/community/headlines/article_page.dart +++ b/lib/community/headlines/article_page.dart @@ -26,6 +26,10 @@ import 'activity_top_list.dart'; import 'article_list.dart'; class ArticlePage extends StatefulWidget { + final Function onScroll; + + ArticlePage(this.onScroll); + @override State createState() { return _ArticlePage(); @@ -34,8 +38,8 @@ class ArticlePage extends StatefulWidget { class _ArticlePage extends State with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { - final ScrollController scrollController = ScrollController(); final RefreshController refreshController = RefreshController(); + ScrollController sc = ScrollController(); ApiService apiService; List globaKeys = []; @@ -50,7 +54,9 @@ class _ArticlePage extends State @override void initState() { super.initState(); - + sc.addListener(() { + widget.onScroll(); + }); eventBus.on().listen((event) { print("object: ArticlePage"); if (event.type < 3) { @@ -204,7 +210,7 @@ class _ArticlePage extends State queryArticleList(false); }, physics: BouncingScrollPhysics(), - scrollController: scrollController, + scrollController: sc, child: Container( child: SingleChildScrollView( physics: BouncingScrollPhysics(), @@ -231,7 +237,7 @@ class _ArticlePage extends State child: StoreTitleTab( brands, globaKeys, - scrollController, + sc, isScroll: true, ), ),