1、聚合搜索关注

This commit is contained in:
cuiyouliang 2025-09-03 11:22:55 +08:00
parent c230d159ab
commit f4dcf8a52d

View File

@ -274,21 +274,20 @@ class _SearchResultPageState extends State<SearchResultPage> with SingleTickerPr
final vlogerId = user['id'];
final doIFollowVloger = user['doIFollowVloger'];
print('是否关注此用户------------->${doIFollowVloger}');
print('此用户UserId------------->${vlogerId}');
if (doIFollowVloger == false) {
if (doIFollowVloger == null || doIFollowVloger == false) {
final res = await ImService.instance.followUser(userIDList: [vlogerId]);
print('关注结果------------->${res.success}');
if (res.success) {
setState(() {
_userResults[index]['doIFollowVloger'] = !_userResults[index]['doIFollowVloger'];
_userResults[index]['doIFollowVloger'] = true;
});
}
}else{
final res = await ImService.instance.followUser(userIDList: [vlogerId]);
final res = await ImService.instance.unfollowUser(userIDList: [vlogerId]);
print('取消关注结果------------->${res.success}');
if (res.success) {
setState(() {
_userResults[index]['doIFollowVloger'] = !_userResults[index]['doIFollowVloger'];
_userResults[index]['doIFollowVloger'] = false;
});
}
}
@ -883,7 +882,7 @@ class _SearchResultPageState extends State<SearchResultPage> with SingleTickerPr
Widget _buildUserItem(Map<String, dynamic> user, int index) {
//
bool isFollowing = user['doIFollowVloger'] ?? false;
print('111111111111111111111111${isFollowing}');
return Container(
margin: const EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.all(10),