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 { class CommunityChildPage extends StatefulWidget {
final String typeStr; final String typeStr;
CommunityChildPage(Key key, this.typeStr): super(key: key); CommunityChildPage(Key key, this.typeStr) : super(key: key);
@override @override
State<StatefulWidget> createState() { 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(); RefreshController refreshController = RefreshController();
ApiService apiService; ApiService apiService;
int pageNum = 1; int pageNum = 1;
@ -56,13 +57,13 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
token: value.getString("token"), token: value.getString("token"),
); );
} }
if(isLoadMore){ if (isLoadMore) {
pageNum += 1; pageNum += 1;
isLoadMore = false; isLoadMore = false;
} } else
else pageNum = 1; pageNum = 1;
BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({ BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({
"mid":"", "mid": "",
"onlyFollow": widget.typeStr == "关注" ? true : false, "onlyFollow": widget.typeStr == "关注" ? true : false,
"onlyMe": false, "onlyMe": false,
"pageNum": pageNum, "pageNum": pageNum,
@ -83,7 +84,7 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
var article = Article(); var article = Article();
article.id = element.id; article.id = element.id;
article.content = jsonEncode(element.subjectInfo); article.content = jsonEncode(element.subjectInfo);
article.mainTitle =element.subject; article.mainTitle = element.subject;
article.followed = element.selfFollow; article.followed = element.selfFollow;
article.authorHeadImg = element.memberInfo?.avatar; article.authorHeadImg = element.memberInfo?.avatar;
article.authorName = element.memberInfo?.nickname; article.authorName = element.memberInfo?.nickname;
@ -125,44 +126,46 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
isLoadMore = true; isLoadMore = true;
setState(() {}); setState(() {});
}, },
child: (articles == null || articles.length == 0)? NoDataView( child: (articles == null || articles.length == 0)
src: "assets/image/guan_zhu.webp", ? NoDataView(
isShowBtn: false, src: "assets/image/guan_zhu.webp",
text: "目前暂无添加关注,可在推荐中关注自己喜欢的人哦~", isShowBtn: false,
fontSize: 16.sp, text: "目前暂无添加关注,可在推荐中关注自己喜欢的人哦~",
margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w), fontSize: 16.sp,
):ListView.builder( margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w),
physics: NeverScrollableScrollPhysics(), )
itemBuilder: (context, position) { : ListView.builder(
return InkWell( physics: NeverScrollableScrollPhysics(),
child: CommunityDynamic( itemBuilder: (context, position) {
articles[position], return InkWell(
0, child: CommunityDynamic(
userId: userId, articles[position],
isList: true, 0,
exitFull: () { userId: userId,
setState(() { isList: true,
onRefresh(); 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