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:
@@ -19,6 +19,7 @@
|
|||||||
🐞 Fixed
|
🐞 Fixed
|
||||||
|
|
||||||
- [[#659]](https://github.com/GetStream/stream-chat-flutter/issues/659) Fixed unread count not updating correctly.
|
- [[#659]](https://github.com/GetStream/stream-chat-flutter/issues/659) Fixed unread count not updating correctly.
|
||||||
|
- Fix `Filter.empty()` json encoding.
|
||||||
|
|
||||||
## 2.2.1
|
## 2.2.1
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,12 @@ class Filter extends Equatable {
|
|||||||
this.key,
|
this.key,
|
||||||
}) : operator = operator.rawValue;
|
}) : 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
|
/// Combines the provided filters and matches the values
|
||||||
/// matched by all filters.
|
/// matched by all filters.
|
||||||
factory Filter.and(List<Filter> filters) =>
|
factory Filter.and(List<Filter> filters) =>
|
||||||
@@ -172,9 +178,6 @@ class Filter extends Equatable {
|
|||||||
String? key,
|
String? key,
|
||||||
}) = Filter.__;
|
}) = Filter.__;
|
||||||
|
|
||||||
/// An empty filter
|
|
||||||
factory Filter.empty() => const Filter.raw(value: {});
|
|
||||||
|
|
||||||
/// Creates a custom [Filter] from a raw map value
|
/// Creates a custom [Filter] from a raw map value
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('empty', () {
|
test('empty', () {
|
||||||
final filter = Filter.empty();
|
const filter = Filter.empty();
|
||||||
expect(filter.value, {});
|
expect(filter.value, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -226,6 +226,12 @@ void main() {
|
|||||||
json.encode(value),
|
json.encode(value),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('empty', () {
|
||||||
|
const filter = Filter.empty();
|
||||||
|
final encoded = json.encode(filter);
|
||||||
|
expect(encoded, '{}');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('groupedFilter', () {
|
test('groupedFilter', () {
|
||||||
|
|||||||
@@ -11,6 +11,13 @@
|
|||||||
pagination = const PaginationParams(limit: 30)
|
pagination = const PaginationParams(limit: 30)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
🔄 Changed
|
||||||
|
|
||||||
|
- `UserListViewCore` filter property now has a default value.
|
||||||
|
```dart
|
||||||
|
filter = const Filter.empty()
|
||||||
|
```
|
||||||
|
|
||||||
🐞 Fixed
|
🐞 Fixed
|
||||||
|
|
||||||
- Fixed `MessageSearchListView` pagination.
|
- Fixed `MessageSearchListView` pagination.
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class UserListView extends StatefulWidget {
|
|||||||
/// Instantiate a new UserListView
|
/// Instantiate a new UserListView
|
||||||
const UserListView({
|
const UserListView({
|
||||||
Key? key,
|
Key? key,
|
||||||
this.filter,
|
this.filter = const Filter.empty(),
|
||||||
this.sort,
|
this.sort,
|
||||||
this.presence,
|
this.presence,
|
||||||
this.pagination = const PaginationParams(limit: 30),
|
this.pagination = const PaginationParams(limit: 30),
|
||||||
@@ -76,6 +76,7 @@ class UserListView extends StatefulWidget {
|
|||||||
/// The query filters to use.
|
/// The query filters to use.
|
||||||
/// You can query on any of the custom fields you've defined on the [Channel].
|
/// You can query on any of the custom fields you've defined on the [Channel].
|
||||||
/// You can also filter other built-in channel fields.
|
/// You can also filter other built-in channel fields.
|
||||||
|
// TODO: Make it non-nullable in a future breaking release
|
||||||
final Filter? filter;
|
final Filter? filter;
|
||||||
|
|
||||||
/// The sorting used for the channels matching the filters.
|
/// The sorting used for the channels matching the filters.
|
||||||
|
|||||||
@@ -11,10 +11,18 @@
|
|||||||
pagination = const PaginationParams(limit: 30)
|
pagination = const PaginationParams(limit: 30)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
🔄 Changed
|
||||||
|
|
||||||
|
- `UserListViewCore` filter property now has a default value.
|
||||||
|
```dart
|
||||||
|
filter = const Filter.empty()
|
||||||
|
```
|
||||||
|
|
||||||
🐞 Fixed
|
🐞 Fixed
|
||||||
|
|
||||||
- Fixed `MessageSearchBloc` pagination.
|
- 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
|
## 2.2.1
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class UserListCore extends StatefulWidget {
|
|||||||
required this.loadingBuilder,
|
required this.loadingBuilder,
|
||||||
required this.listBuilder,
|
required this.listBuilder,
|
||||||
Key? key,
|
Key? key,
|
||||||
this.filter,
|
this.filter = const Filter.empty(),
|
||||||
this.sort,
|
this.sort,
|
||||||
this.presence,
|
this.presence,
|
||||||
this.pagination = const PaginationParams(limit: 30),
|
this.pagination = const PaginationParams(limit: 30),
|
||||||
@@ -91,6 +91,7 @@ class UserListCore extends StatefulWidget {
|
|||||||
/// The query filters to use.
|
/// The query filters to use.
|
||||||
/// You can query on any of the custom fields you've defined on the [Channel].
|
/// You can query on any of the custom fields you've defined on the [Channel].
|
||||||
/// You can also filter other built-in channel fields.
|
/// You can also filter other built-in channel fields.
|
||||||
|
// TODO: Make it non-nullable in a future breaking release
|
||||||
final Filter? filter;
|
final Filter? filter;
|
||||||
|
|
||||||
/// The sorting used for the channels matching the filters.
|
/// The sorting used for the channels matching the filters.
|
||||||
|
|||||||
Reference in New Issue
Block a user