refactor (core <-> ui <-> persistence) with the new filter changes.

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-04-27 15:41:00 +05:30
parent f683961581
commit 8c666caa52
24 changed files with 180 additions and 195 deletions
@@ -92,7 +92,7 @@ class ChannelListCore 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.
final Map<String, dynamic>? filter;
final Filter? filter;
/// Query channels options.
///
@@ -88,7 +88,7 @@ class ChannelsBlocState extends State<ChannelsBloc>
/// Calls [client.queryChannels] updating [queryChannelsLoading] stream
Future<void> queryChannels({
Map<String, dynamic>? filter,
Filter? filter,
List<SortOption<ChannelModel>>? sortOptions,
PaginationParams paginationParams = const PaginationParams(limit: 30),
Map<String, dynamic>? options,
@@ -160,9 +160,8 @@ class ChannelsBlocState extends State<ChannelsBloc>
newChannels.insert(0, _hiddenChannels[hiddenIndex]);
_hiddenChannels.removeAt(hiddenIndex);
} else {
if (client.state.channels != null &&
client.state.channels?[e.cid] != null) {
newChannels.insert(0, client.state.channels![e.cid]!);
if (client.state.channels[e.cid] != null) {
newChannels.insert(0, client.state.channels[e.cid]!);
}
}
}
@@ -9,7 +9,7 @@ import 'package:stream_chat_flutter_core/src/stream_chat_core.dart';
/// [MessageSearchBloc] can be access at anytime by using the static [of] method
/// using Flutter's [BuildContext].
///
// API docs: https://getstream.io/chat/docs/flutter-dart/send_message/
/// API docs: https://getstream.io/chat/docs/flutter-dart/send_message/
class MessageSearchBloc extends StatefulWidget {
/// Instantiate a new MessageSearchBloc
const MessageSearchBloc({
@@ -58,7 +58,7 @@ class MessageSearchBlocState extends State<MessageSearchBloc>
/// Calls [StreamChatClient.search] updating
/// [messagesStream] and [queryMessagesLoading] stream
Future<void> search({
required Map<String, dynamic> filter,
required Filter filter,
Map<String, dynamic>? messageFilter,
List<SortOption>? sort,
String? query,
@@ -67,7 +67,7 @@ class MessageSearchListCore 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.
final Map<String, dynamic> filters;
final Filter filters;
/// The sorting used for the channels matching the filters.
/// Sorting is based on field and direction, multiple sorting options can be