|
|
|
@ -98,54 +98,52 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
|
|
|
|
|
///动态列表 |
|
|
|
|
queryCommunity(String searchKey) async { |
|
|
|
|
if(!isRefresh){ |
|
|
|
|
if (!isRefresh) { |
|
|
|
|
isRefresh = true; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if(isLoadingData){ |
|
|
|
|
if (isLoadingData) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
isLoadingData = true; |
|
|
|
|
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){ |
|
|
|
|
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": memberId == "0" ? userId : memberId, |
|
|
|
|
"onlyFollow": false, |
|
|
|
|
"onlyMe": true, |
|
|
|
|
"pageNum": searchKey == null?pageNum:1, |
|
|
|
|
"pageNum": searchKey == null ? pageNum : 1, |
|
|
|
|
"pageSize": 10, |
|
|
|
|
"searchKey": searchKey??"" |
|
|
|
|
"searchKey": searchKey ?? "" |
|
|
|
|
}).catchError((error) { |
|
|
|
|
if(searchKey == null) { |
|
|
|
|
if (searchKey == null) { |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if(searchKey == null){ |
|
|
|
|
if (searchKey == null) { |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
refreshController.loadComplete(); |
|
|
|
|
} |
|
|
|
|
if (baseData.isSuccess) { |
|
|
|
|
if(searchKey != null){ |
|
|
|
|
if(baseData?.data?.list != null && baseData.data.list.isNotEmpty) |
|
|
|
|
if (searchKey != null) { |
|
|
|
|
if (baseData?.data?.list != null && baseData.data.list.isNotEmpty) |
|
|
|
|
articles.forEach((element) { |
|
|
|
|
if(element.id == searchKey){ |
|
|
|
|
if (element.id == searchKey) { |
|
|
|
|
element.content = jsonEncode(baseData.data.list[0].subjectInfo); |
|
|
|
|
element.mainTitle =baseData.data.list[0].subject; |
|
|
|
|
element.mainTitle = baseData.data.list[0].subject; |
|
|
|
|
element.followed = baseData.data.list[0].selfFollow; |
|
|
|
|
element.liked = baseData.data.list[0].selfLike; |
|
|
|
|
element.authorHeadImg = baseData.data.list[0].memberInfo?.avatar; |
|
|
|
|
element.authorName = baseData.data.list[0].memberInfo?.nickname; |
|
|
|
|
element.location = baseData.data.list[0].location; |
|
|
|
@ -155,12 +153,10 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
element.likes = baseData.data.list[0]?.likes; |
|
|
|
|
element.comments = baseData.data.list[0]?.comments; |
|
|
|
|
this.isRefresh = false; |
|
|
|
|
setState(() { |
|
|
|
|
}); |
|
|
|
|
setState(() {}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
} else { |
|
|
|
|
if (pageNum == 1) { |
|
|
|
|
articles.clear(); |
|
|
|
|
} |
|
|
|
@ -168,8 +164,9 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
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.liked = element.selfLike; |
|
|
|
|
article.authorHeadImg = element.memberInfo?.avatar; |
|
|
|
|
article.authorName = element.memberInfo?.nickname; |
|
|
|
|
article.location = element.location; |
|
|
|
@ -180,8 +177,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
article.comments = element?.comments; |
|
|
|
|
articles.add(article); |
|
|
|
|
}); |
|
|
|
|
setState(() { |
|
|
|
|
}); |
|
|
|
|
setState(() {}); |
|
|
|
|
// comments.sort((a,b)=>b.createTime.compareTo(a.createTime)); |
|
|
|
|
// print("comments: ${comments.length}"); |
|
|
|
|
if (int.tryParse(baseData.data.total) < (pageNum * 10)) { |
|
|
|
@ -350,7 +346,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
height: 248, |
|
|
|
|
height: 248.h, |
|
|
|
|
color: Color(0xFFFFFFFF), |
|
|
|
|
// color: Colors.red, |
|
|
|
|
child: Stack( |
|
|
|
@ -359,7 +355,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
Positioned( |
|
|
|
|
top: 0, |
|
|
|
|
left: 0, |
|
|
|
|
bottom: 36, |
|
|
|
|
bottom: 36.h, |
|
|
|
|
right: 0, |
|
|
|
|
child: Stack( |
|
|
|
|
alignment: Alignment.bottomRight, |
|
|
|
@ -402,7 +398,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
), |
|
|
|
|
if (memberId == "0") |
|
|
|
|
Positioned( |
|
|
|
|
bottom: 9, |
|
|
|
|
bottom: 9.h, |
|
|
|
|
right: 16.w, |
|
|
|
|
child: GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
@ -438,12 +434,14 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
color: Color(0xFFFFFFFF), |
|
|
|
|
margin: EdgeInsets.only(bottom:30.h), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
margin: EdgeInsets.only(left: 86, top: 12, right: 16), |
|
|
|
|
margin: |
|
|
|
|
EdgeInsets.only(left: 86.w, top: 12.h, right: 16.w), |
|
|
|
|
child: GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
@ -470,7 +468,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
color: Color(0xFF868686), |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
height: 1.5), |
|
|
|
|
height: 1.5.h), |
|
|
|
|
)), |
|
|
|
|
Icon( |
|
|
|
|
(isShrink != null && !isShrink) |
|
|
|
@ -483,7 +481,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
Container( |
|
|
|
|
margin: EdgeInsets.only(left: 16, right: 16), |
|
|
|
|
margin: EdgeInsets.only(left: 16.w, right: 16.w), |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
@ -508,7 +506,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 4, |
|
|
|
|
height: 4.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
S.of(context).guanzhu, |
|
|
|
@ -542,7 +540,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 4, |
|
|
|
|
height: 4.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
S.of(context).fensi, |
|
|
|
@ -575,7 +573,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 4, |
|
|
|
|
height: 4.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
S.of(context).dongtai, |
|
|
|
@ -608,10 +606,10 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 4, |
|
|
|
|
height: 4.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"获赞", |
|
|
|
|
S.of(context).huozan, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
@ -631,7 +629,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
color: Color(0xFFF7F7F7), |
|
|
|
|
), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 16), |
|
|
|
|
padding: EdgeInsets.only(left: 16.w), |
|
|
|
|
child: Text( |
|
|
|
|
memberId != "0" ? "TA的动态" : "我的动态", |
|
|
|
|
style: TextStyle( |
|
|
|
@ -640,7 +638,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
dynamicList() |
|
|
|
|
dynamicList(), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -657,8 +655,8 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
right: 0, |
|
|
|
|
child: Container( |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
left: 16, |
|
|
|
|
right: 16, |
|
|
|
|
left: 16.w, |
|
|
|
|
right: 16.w, |
|
|
|
|
), |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
@ -691,7 +689,9 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
), |
|
|
|
|
SizedBox(width: 10.w), |
|
|
|
|
Text( |
|
|
|
|
memberInfor?.nickname ?? "", |
|
|
|
|
((memberInfor?.nickname ?? "") == "") |
|
|
|
|
? "回乡" |
|
|
|
|
: memberInfor?.nickname, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 16.sp, |
|
|
|
@ -714,14 +714,14 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
height: 23, |
|
|
|
|
padding: |
|
|
|
|
EdgeInsets.only(left: 6, right: 6, bottom: 2, top: 2), |
|
|
|
|
height: 23.h, |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
left: 6.w, right: 6.w, bottom: 2.h, top: 2.h), |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(100), |
|
|
|
|
border: Border.all( |
|
|
|
|
width: 1, |
|
|
|
|
width: 1.w, |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
style: BorderStyle.solid, |
|
|
|
|
), |
|
|
|
@ -749,7 +749,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
isShowBtn: false, |
|
|
|
|
text: "目前暂无发布动态,要把开心的事讲出来哦~", |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
margin: EdgeInsets.only(left: 60.w, right: 60.w), |
|
|
|
|
margin: EdgeInsets.only(left: 60.w, right: 60.w, bottom: 75.h), |
|
|
|
|
) |
|
|
|
|
: ListView.builder( |
|
|
|
|
physics: NeverScrollableScrollPhysics(), |
|
|
|
@ -760,9 +760,9 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
|
|
|
|
|
articles[position], |
|
|
|
|
memberId == "0" ? 1 : 0, |
|
|
|
|
exitFull: () { |
|
|
|
|
// setState(() { |
|
|
|
|
// _onRefresh(); |
|
|
|
|
// }); |
|
|
|
|
setState(() { |
|
|
|
|
_onRefresh(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
removalDynamic: () { |
|
|
|
|
setState(() { |
|
|
|
|