case insensitive search + onion search only from start #151
|
@ -64,13 +64,13 @@ class ContactListState extends ChangeNotifier {
|
||||||
bool get isFiltered => _filter != "";
|
bool get isFiltered => _filter != "";
|
||||||
String get filter => _filter;
|
String get filter => _filter;
|
||||||
set filter(String newVal) {
|
set filter(String newVal) {
|
||||||
_filter = newVal;
|
_filter = newVal.toLowerCase();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ContactInfoState> filteredList() {
|
List<ContactInfoState> filteredList() {
|
||||||
if (!isFiltered) return contacts;
|
if (!isFiltered) return contacts;
|
||||||
return _contacts.where((ContactInfoState c) => c.onion.contains(_filter) || (c.nickname.contains(_filter))).toList();
|
return _contacts.where((ContactInfoState c) => c.onion.toLowerCase().startsWith(_filter) || (c.nickname.toLowerCase().contains(_filter))).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void addAll(Iterable<ContactInfoState> newContacts) {
|
void addAll(Iterable<ContactInfoState> newContacts) {
|
||||||
|
|
Loading…
Reference in New Issue