From 59dacb4da7a5520b95909baac4d69af1aa310df2 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Tue, 19 Apr 2022 10:02:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E7=BE=A4=E5=88=97=E8=A1=A8=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/community_child_page.dart | 9 +++++++-- lib/community/community_page.dart | 27 ++++++++++++++++++++++--- lib/retrofit/min_api.dart | 2 +- lib/retrofit/retrofit_api.dart | 2 +- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index b4c84200..7eee6f2b 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -17,8 +17,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; class CommunityChildPage extends StatefulWidget { final String typeStr; + final Function onScroll; - CommunityChildPage(Key key, this.typeStr): super(key: key); + CommunityChildPage(Key key, this.typeStr,this.onScroll): super(key: key); @override State createState() { @@ -32,12 +33,16 @@ class CommunityChildPageState extends State with AutomaticKe int pageNum = 1; String userId; bool isLoadMore = false; + ScrollController sc = ScrollController(); List
articles = []; @override void initState() { super.initState(); + sc.addListener(() { + widget.onScroll(); + }); onRefresh(); } @@ -132,7 +137,7 @@ class CommunityChildPageState extends State with AutomaticKe fontSize: 16.sp, margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w), ):ListView.builder( - physics: NeverScrollableScrollPhysics(), + controller: sc, itemBuilder: (context, position) { return InkWell( child: CommunityDynamic( diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index 92124c1f..68f145ea 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -32,15 +32,36 @@ class _CommunityPage extends State "关于回乡", // "直播", ]; + ScrollPhysics b = BouncingScrollPhysics(); + int scrollCount = 0; @override void initState() { super.initState(); + + if (tabcontroller == null) tabcontroller = TabController(length: lables.length, vsync: this, initialIndex: 1); } + void onChildScroll(){ + if(scrollCount == 0){ + setState(() { + b = NeverScrollableScrollPhysics(); + }); + } + scrollCount+=1; + Future.delayed(Duration(seconds:1), () { + scrollCount-=1; + if(scrollCount == 0){ + setState(() { + b = BouncingScrollPhysics(); + }); + } + }); + } + _toRelease() async { await Navigator.of(context).pushNamed('/router/release_dynamic'); if(tabcontroller.index == 0){ @@ -101,7 +122,7 @@ class _CommunityPage extends State body: Container( padding: EdgeInsets.only(bottom: 76.h), child: TabBarView( - physics: BouncingScrollPhysics(), + physics: b, children: lables.map((e) { if (e == "关于回乡") { return BrandPage(); @@ -112,12 +133,12 @@ class _CommunityPage extends State } else if(e == "分享健康"){ if (tuijian == null){ - tuijian = CommunityChildPage(tuijianKey,"分享健康"); + tuijian = CommunityChildPage(tuijianKey,"分享健康",onChildScroll); } return tuijian; }else if(e == "关注"){ if (guanzhu == null){ - guanzhu = CommunityChildPage(guanzhuKey,"关注"); + guanzhu = CommunityChildPage(guanzhuKey,"关注",onChildScroll); } return guanzhu; } diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 33adbca6..ebe58ba5 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -32,7 +32,7 @@ part 'min_api.g.dart'; // const base_url = "http://192.168.10.37:8766/app/"; -const localBaseUrl = "https://pos.api.lotus-wallet.com/app/";///本地 +const localBaseUrl = "http://192.168.10.236:8766/app/";///本地 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 751209d3..65a3ccda 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -68,7 +68,7 @@ part 'retrofit_api.g.dart'; // const base_url = "http://192.168.10.132:8766/app/";///詹云久 -const localBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///本地 +const localBaseUrl = "http://192.168.10.236:8766/app/";///本地 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 @RestApi(baseUrl: localBaseUrl)