Skip to content
Snippets Groups Projects
Commit ff28d1e9 authored by vjrj's avatar vjrj
Browse files

Fix sorting and search of contacts

parent 10e1b4c8
No related branches found
No related tags found
No related merge requests found
......@@ -113,12 +113,15 @@ class ContactsCubit extends HydratedCubit<ContactsState> {
}
void sortContacts(ContactsSortType sortOrder) {
List<Contact> sortedContacts = List<Contact>.from(state.contacts);
List<Contact> sortedContacts = List<Contact>.from(state.filteredContacts);
if (sortOrder == ContactsSortType.alpha) {
sortContactList(sortedContacts);
} else if (sortOrder == ContactsSortType.date) {
sortedContacts = List<Contact>.from(state.contacts);
sortedContacts = List<Contact>.from(state.contacts).where((Contact c) {
return state.filteredContacts
.any((Contact fc) => fc.pubKey == c.pubKey);
}).toList();
}
emit(state.copyWith(filteredContacts: sortedContacts, order: sortOrder));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment