|
|
|
@ -20,7 +20,8 @@ class CommunityChildPage extends StatefulWidget {
|
|
|
|
|
final Function onScroll; |
|
|
|
|
final Function toRelease; |
|
|
|
|
|
|
|
|
|
CommunityChildPage(Key key, this.typeStr,this.onScroll,this.toRelease): super(key: key); |
|
|
|
|
CommunityChildPage(Key key, this.typeStr, this.onScroll, this.toRelease) |
|
|
|
|
: super(key: key); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
State<StatefulWidget> createState() { |
|
|
|
@ -28,7 +29,8 @@ class CommunityChildPage extends StatefulWidget {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKeepAliveClientMixin { |
|
|
|
|
class CommunityChildPageState extends State<CommunityChildPage> |
|
|
|
|
with AutomaticKeepAliveClientMixin { |
|
|
|
|
RefreshController refreshController = RefreshController(); |
|
|
|
|
ApiService apiService; |
|
|
|
|
int pageNum = 1; |
|
|
|
@ -65,18 +67,15 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
|
|
|
|
|
if (apiService == null) { |
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
|
userId = value.getString('userId'); |
|
|
|
|
apiService = ApiService( |
|
|
|
|
Dio(), |
|
|
|
|
apiService = ApiService(Dio(), |
|
|
|
|
context: context, |
|
|
|
|
token: value.getString("token"), |
|
|
|
|
showLoading: false |
|
|
|
|
); |
|
|
|
|
showLoading: false); |
|
|
|
|
} |
|
|
|
|
if (isLoadMore) { |
|
|
|
|
pageNum += 1; |
|
|
|
|
isLoadMore = false; |
|
|
|
|
} |
|
|
|
|
else if(searchKey == null)pageNum = 1; |
|
|
|
|
} else if (searchKey == null) pageNum = 1; |
|
|
|
|
BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({ |
|
|
|
|
"mid": "", |
|
|
|
|
"onlyFollow": widget.typeStr == "关注" ? true : false, |
|
|
|
@ -111,8 +110,7 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
|
|
|
|
|
element.likes = baseData.data.list[0]?.likes; |
|
|
|
|
element.comments = baseData.data.list[0]?.comments; |
|
|
|
|
this.isRefresh = false; |
|
|
|
|
setState(() { |
|
|
|
|
}); |
|
|
|
|
setState(() {}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
@ -152,7 +150,10 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
|
|
|
|
|
return FutureBuilder( |
|
|
|
|
future: queryCommunity(null), |
|
|
|
|
builder: (context, position) { |
|
|
|
|
return SmartRefresher( |
|
|
|
|
return Stack( |
|
|
|
|
alignment: Alignment.bottomRight, |
|
|
|
|
children: [ |
|
|
|
|
SmartRefresher( |
|
|
|
|
controller: refreshController, |
|
|
|
|
enablePullDown: true, |
|
|
|
|
enablePullUp: true, |
|
|
|
@ -168,18 +169,16 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
|
|
|
|
|
isLoadMore = true; |
|
|
|
|
setState(() {}); |
|
|
|
|
}, |
|
|
|
|
child: Stack( |
|
|
|
|
alignment: Alignment.bottomRight, |
|
|
|
|
children: [ |
|
|
|
|
(articles == null || articles.length == 0)? NoDataView( |
|
|
|
|
child: (articles == null || articles.length == 0) |
|
|
|
|
? NoDataView( |
|
|
|
|
src: "assets/image/guan_zhu.webp", |
|
|
|
|
isShowBtn: false, |
|
|
|
|
text: "目前暂无添加关注,可在推荐中关注自己喜欢的人哦~", |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w), |
|
|
|
|
margin: |
|
|
|
|
EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w), |
|
|
|
|
) |
|
|
|
|
: |
|
|
|
|
ListView.builder( |
|
|
|
|
: ListView.builder( |
|
|
|
|
controller: sc, |
|
|
|
|
shrinkWrap: true, |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
@ -212,6 +211,7 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
|
|
|
|
|
}, |
|
|
|
|
itemCount: articles.length, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
widget.toRelease(); |
|
|
|
@ -226,7 +226,6 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
|
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|