|
|
@ -97,26 +97,42 @@ class _FriendListState extends State<FriendList> { |
|
|
|
} |
|
|
|
|
|
|
|
void filterSearchResults(String query) { |
|
|
|
List<Friend> dummySearchList = []; |
|
|
|
dummySearchList.addAll(friends); |
|
|
|
List<Friend> dummyFriendsList = []; |
|
|
|
List<Friend> dummyFriendRequestsList = []; |
|
|
|
dummyFriendsList.addAll(friends); |
|
|
|
dummyFriendRequestsList.addAll(friendRequests); |
|
|
|
|
|
|
|
if(query.isNotEmpty) { |
|
|
|
List<Friend> dummyListData = []; |
|
|
|
for (Friend item in dummySearchList) { |
|
|
|
if (query.isNotEmpty) { |
|
|
|
List<Friend> dummyFriendData = []; |
|
|
|
List<Friend> dummyFriendRequestData = []; |
|
|
|
|
|
|
|
for (Friend item in dummyFriendsList) { |
|
|
|
if(item.username.toLowerCase().contains(query)) { |
|
|
|
dummyListData.add(item); |
|
|
|
dummyFriendData.add(item); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (Friend item in dummyFriendRequestsList) { |
|
|
|
if(item.username.toLowerCase().contains(query)) { |
|
|
|
dummyFriendRequestData.add(item); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setState(() { |
|
|
|
friends.clear(); |
|
|
|
friends.addAll(dummyListData); |
|
|
|
friends.addAll(dummyFriendData); |
|
|
|
friendRequests.clear(); |
|
|
|
friendRequests.addAll(dummyFriendRequestData); |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
setState(() { |
|
|
|
friends.clear(); |
|
|
|
friends.addAll(friends); |
|
|
|
friends.addAll(widget.friends); |
|
|
|
friendRequests.clear(); |
|
|
|
friendRequests.addAll(widget.friendRequests); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|