w-R 3 years ago
parent
commit
fef6d9fabb
  1. 89
      lib/community/community_child_page.dart

89
lib/community/community_child_page.dart

@ -18,7 +18,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
class CommunityChildPage extends StatefulWidget {
final String typeStr;
CommunityChildPage(Key key, this.typeStr): super(key: key);
CommunityChildPage(Key key, this.typeStr) : super(key: key);
@override
State<StatefulWidget> createState() {
@ -26,7 +26,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;
@ -56,13 +57,13 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
token: value.getString("token"),
);
}
if(isLoadMore){
if (isLoadMore) {
pageNum += 1;
isLoadMore = false;
}
else pageNum = 1;
} else
pageNum = 1;
BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({
"mid":"",
"mid": "",
"onlyFollow": widget.typeStr == "关注" ? true : false,
"onlyMe": false,
"pageNum": pageNum,
@ -83,7 +84,7 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
var article = Article();
article.id = element.id;
article.content = jsonEncode(element.subjectInfo);
article.mainTitle =element.subject;
article.mainTitle = element.subject;
article.followed = element.selfFollow;
article.authorHeadImg = element.memberInfo?.avatar;
article.authorName = element.memberInfo?.nickname;
@ -125,44 +126,46 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
isLoadMore = true;
setState(() {});
},
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),
):ListView.builder(
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(
child: CommunityDynamic(
articles[position],
0,
userId: userId,
isList: true,
exitFull: () {
setState(() {
onRefresh();
});
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),
)
: ListView.builder(
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(
child: CommunityDynamic(
articles[position],
0,
userId: userId,
isList: true,
exitFull: () {
setState(() {
onRefresh();
});
},
),
onTap: () {
Navigator.of(context).pushNamed(
'/router/community_details',
arguments: {
"businessId": articles[position].id,
"userId": userId,
},
).then((value) {
onRefresh();
setState(() {});
});
setState(() {});
},
);
},
itemCount: articles.length,
),
onTap: () {
Navigator.of(context).pushNamed(
'/router/community_details',
arguments: {
"businessId": articles[position].id,
"userId": userId,
},
).then((value) {
onRefresh();
setState(() {});
});
setState(() {});
},
);
},
itemCount: articles.length,
),
);
},
);

Loading…
Cancel
Save