Merge pull request #686 from GetStream/feat/default-user-list-filter

feat(core, ui): Add `Filter.empty` as the default filter in `UserListView`.
This commit is contained in:
Salvatore Giordano
2021-09-16 11:39:34 +02:00
committed by GitHub
7 changed files with 34 additions and 7 deletions
+1
View File
@@ -19,6 +19,7 @@
🐞 Fixed
- [[#659]](https://github.com/GetStream/stream-chat-flutter/issues/659) Fixed unread count not updating correctly.
- Fix `Filter.empty()` json encoding.
## 2.2.1
@@ -102,6 +102,12 @@ class Filter extends Equatable {
this.key,
}) : operator = operator.rawValue;
/// An empty filter
const Filter.empty()
: value = const <String, Object?>{},
operator = null,
key = null;
/// Combines the provided filters and matches the values
/// matched by all filters.
factory Filter.and(List<Filter> filters) =>
@@ -172,9 +178,6 @@ class Filter extends Equatable {
String? key,
}) = Filter.__;
/// An empty filter
factory Filter.empty() => const Filter.raw(value: {});
/// Creates a custom [Filter] from a raw map value
///
/// ```dart
@@ -139,7 +139,7 @@ void main() {
});
test('empty', () {
final filter = Filter.empty();
const filter = Filter.empty();
expect(filter.value, {});
});
@@ -226,6 +226,12 @@ void main() {
json.encode(value),
);
});
test('empty', () {
const filter = Filter.empty();
final encoded = json.encode(filter);
expect(encoded, '{}');
});
});
test('groupedFilter', () {
@@ -11,6 +11,13 @@
pagination = const PaginationParams(limit: 30)
```
🔄 Changed
- `UserListViewCore` filter property now has a default value.
```dart
filter = const Filter.empty()
```
🐞 Fixed
- Fixed `MessageSearchListView` pagination.
@@ -48,7 +48,7 @@ class UserListView extends StatefulWidget {
/// Instantiate a new UserListView
const UserListView({
Key? key,
this.filter,
this.filter = const Filter.empty(),
this.sort,
this.presence,
this.pagination = const PaginationParams(limit: 30),
@@ -76,6 +76,7 @@ class UserListView extends StatefulWidget {
/// The query filters to use.
/// You can query on any of the custom fields you've defined on the [Channel].
/// You can also filter other built-in channel fields.
// TODO: Make it non-nullable in a future breaking release
final Filter? filter;
/// The sorting used for the channels matching the filters.
@@ -11,10 +11,18 @@
pagination = const PaginationParams(limit: 30)
```
🔄 Changed
- `UserListViewCore` filter property now has a default value.
```dart
filter = const Filter.empty()
```
🐞 Fixed
- Fixed `MessageSearchBloc` pagination.
- [[#673]](https://github.com/GetStream/stream-chat-flutter/issues/673): Fix `Core Widgets` not getting rebuild with new data on configuration change.
- [[#673]](https://github.com/GetStream/stream-chat-flutter/issues/673): Fix `Core Widgets` not getting rebuild with new
data on configuration change.
## 2.2.1
@@ -63,7 +63,7 @@ class UserListCore extends StatefulWidget {
required this.loadingBuilder,
required this.listBuilder,
Key? key,
this.filter,
this.filter = const Filter.empty(),
this.sort,
this.presence,
this.pagination = const PaginationParams(limit: 30),
@@ -91,6 +91,7 @@ class UserListCore extends StatefulWidget {
/// The query filters to use.
/// You can query on any of the custom fields you've defined on the [Channel].
/// You can also filter other built-in channel fields.
// TODO: Make it non-nullable in a future breaking release
final Filter? filter;
/// The sorting used for the channels matching the filters.