rfac: Added core prefixes
This commit is contained in:
+9
-9
@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:stream_chat/stream_chat.dart';
|
import 'package:stream_chat/stream_chat.dart';
|
||||||
import 'package:stream_chat_flutter_core/src/channels_bloc.dart';
|
import 'package:stream_chat_flutter_core/src/channels_bloc.dart';
|
||||||
|
|
||||||
import 'stream_chat.dart';
|
import 'stream_chat_core.dart';
|
||||||
|
|
||||||
/// 
|
/// 
|
||||||
/// 
|
/// 
|
||||||
@@ -36,14 +36,14 @@ import 'stream_chat.dart';
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// Make sure to have a [StreamChat] ancestor in order to provide the information about the channels.
|
/// Make sure to have a [StreamChatCore] ancestor in order to provide the information about the channels.
|
||||||
/// The widget uses a [ListView.custom] to render the list of channels.
|
/// The widget uses a [ListView.custom] to render the list of channels.
|
||||||
///
|
///
|
||||||
/// The widget components render the ui based on the first ancestor of type [StreamChatTheme].
|
/// The widget components render the ui based on the first ancestor of type [StreamChatTheme].
|
||||||
/// Modify it to change the widget appearance.
|
/// Modify it to change the widget appearance.
|
||||||
class ChannelListView extends StatefulWidget {
|
class ChannelListViewCore extends StatefulWidget {
|
||||||
/// Instantiate a new ChannelListView
|
/// Instantiate a new ChannelListView
|
||||||
ChannelListView({
|
ChannelListViewCore({
|
||||||
Key key,
|
Key key,
|
||||||
this.filter,
|
this.filter,
|
||||||
this.options,
|
this.options,
|
||||||
@@ -96,10 +96,10 @@ class ChannelListView extends StatefulWidget {
|
|||||||
final bool pullToRefresh;
|
final bool pullToRefresh;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_ChannelListViewState createState() => _ChannelListViewState();
|
_ChannelListViewCoreState createState() => _ChannelListViewCoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ChannelListViewState extends State<ChannelListView>
|
class _ChannelListViewCoreState extends State<ChannelListViewCore>
|
||||||
with WidgetsBindingObserver {
|
with WidgetsBindingObserver {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -197,7 +197,7 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
options: widget.options,
|
options: widget.options,
|
||||||
);
|
);
|
||||||
|
|
||||||
final client = StreamChat.of(context).client;
|
final client = StreamChatCore.of(context).client;
|
||||||
|
|
||||||
_subscription = client
|
_subscription = client
|
||||||
.on(
|
.on(
|
||||||
@@ -221,7 +221,7 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didUpdateWidget(ChannelListView oldWidget) {
|
void didUpdateWidget(ChannelListViewCore oldWidget) {
|
||||||
super.didUpdateWidget(oldWidget);
|
super.didUpdateWidget(oldWidget);
|
||||||
|
|
||||||
if (widget.filter?.toString() != oldWidget.filter?.toString() ||
|
if (widget.filter?.toString() != oldWidget.filter?.toString() ||
|
||||||
@@ -247,7 +247,7 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Controller used for paginating data in [ChannelListView]
|
/// Controller used for paginating data in [ChannelListViewCore]
|
||||||
class ChannelListController {
|
class ChannelListController {
|
||||||
VoidCallback paginateData;
|
VoidCallback paginateData;
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ import 'dart:async';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
import 'package:stream_chat/stream_chat.dart';
|
import 'package:stream_chat/stream_chat.dart';
|
||||||
import 'package:stream_chat_flutter_core/src/stream_chat.dart';
|
import 'package:stream_chat_flutter_core/src/stream_chat_core.dart';
|
||||||
|
|
||||||
/// Widget dedicated to the management of a channel list with pagination
|
/// Widget dedicated to the management of a channel list with pagination
|
||||||
class ChannelsBloc extends StatefulWidget {
|
class ChannelsBloc extends StatefulWidget {
|
||||||
@@ -79,7 +79,7 @@ class ChannelsBlocState extends State<ChannelsBloc>
|
|||||||
Map<String, dynamic> options,
|
Map<String, dynamic> options,
|
||||||
bool onlyOffline = false,
|
bool onlyOffline = false,
|
||||||
}) async {
|
}) async {
|
||||||
final client = StreamChat.of(context).client;
|
final client = StreamChatCore.of(context).client;
|
||||||
|
|
||||||
if (client.state?.user == null ||
|
if (client.state?.user == null ||
|
||||||
_queryChannelsLoadingController.value == true) {
|
_queryChannelsLoadingController.value == true) {
|
||||||
@@ -120,7 +120,7 @@ class ChannelsBlocState extends State<ChannelsBloc>
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
final client = StreamChat.of(context).client;
|
final client = StreamChatCore.of(context).client;
|
||||||
|
|
||||||
if (!widget.lockChannelsOrder) {
|
if (!widget.lockChannelsOrder) {
|
||||||
_subscriptions.add(client.on(EventType.messageNew).listen((e) {
|
_subscriptions.add(client.on(EventType.messageNew).listen((e) {
|
||||||
|
|||||||
+5
-5
@@ -45,9 +45,9 @@ import 'stream_channel.dart';
|
|||||||
///
|
///
|
||||||
/// The widget components render the ui based on the first ancestor of type [StreamChatTheme].
|
/// The widget components render the ui based on the first ancestor of type [StreamChatTheme].
|
||||||
/// Modify it to change the widget appearance.
|
/// Modify it to change the widget appearance.
|
||||||
class MessageListView extends StatefulWidget {
|
class MessageListViewCore extends StatefulWidget {
|
||||||
/// Instantiate a new MessageListView
|
/// Instantiate a new MessageListView
|
||||||
MessageListView({
|
MessageListViewCore({
|
||||||
Key key,
|
Key key,
|
||||||
this.showScrollToBottom = true,
|
this.showScrollToBottom = true,
|
||||||
this.parentMessage,
|
this.parentMessage,
|
||||||
@@ -58,7 +58,7 @@ class MessageListView extends StatefulWidget {
|
|||||||
this.messageListController,
|
this.messageListController,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
MessageListController messageListController;
|
final MessageListController messageListController;
|
||||||
|
|
||||||
final Widget Function(BuildContext, List<Message>) messageListBuilder;
|
final Widget Function(BuildContext, List<Message>) messageListBuilder;
|
||||||
|
|
||||||
@@ -78,10 +78,10 @@ class MessageListView extends StatefulWidget {
|
|||||||
final Widget Function(DateTime) dateDividerBuilder;
|
final Widget Function(DateTime) dateDividerBuilder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MessageListViewState createState() => _MessageListViewState();
|
_MessageListViewCoreState createState() => _MessageListViewCoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MessageListViewState extends State<MessageListView> {
|
class _MessageListViewCoreState extends State<MessageListViewCore> {
|
||||||
StreamChannelState streamChannel;
|
StreamChannelState streamChannel;
|
||||||
|
|
||||||
bool get _upToDate => streamChannel.channel.state.isUpToDate;
|
bool get _upToDate => streamChannel.channel.state.isUpToDate;
|
||||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
import 'package:stream_chat/stream_chat.dart';
|
import 'package:stream_chat/stream_chat.dart';
|
||||||
|
|
||||||
import 'stream_chat.dart';
|
import 'stream_chat_core.dart';
|
||||||
|
|
||||||
/// Widget dedicated to the management of a message list with pagination
|
/// Widget dedicated to the management of a message list with pagination
|
||||||
class MessageSearchBloc extends StatefulWidget {
|
class MessageSearchBloc extends StatefulWidget {
|
||||||
@@ -122,7 +122,7 @@ class MessageSearchBlocState extends State<MessageSearchBloc>
|
|||||||
String query,
|
String query,
|
||||||
PaginationParams pagination,
|
PaginationParams pagination,
|
||||||
}) {
|
}) {
|
||||||
final client = StreamChat.of(context).client;
|
final client = StreamChatCore.of(context).client;
|
||||||
return client.search(
|
return client.search(
|
||||||
filter,
|
filter,
|
||||||
sort,
|
sort,
|
||||||
|
|||||||
+7
-7
@@ -2,7 +2,6 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat/stream_chat.dart';
|
import 'package:stream_chat/stream_chat.dart';
|
||||||
import 'lazy_load_scroll_view.dart';
|
|
||||||
import 'message_search_bloc.dart';
|
import 'message_search_bloc.dart';
|
||||||
|
|
||||||
/// Callback called when tapping on a user
|
/// Callback called when tapping on a user
|
||||||
@@ -12,7 +11,7 @@ typedef MessageSearchItemTapCallback = void Function(GetMessageResponse);
|
|||||||
typedef MessageSearchItemBuilder = Widget Function(
|
typedef MessageSearchItemBuilder = Widget Function(
|
||||||
BuildContext, GetMessageResponse);
|
BuildContext, GetMessageResponse);
|
||||||
|
|
||||||
/// Builder used when [MessageSearchListView] is empty
|
/// Builder used when [MessageSearchListViewCore] is empty
|
||||||
typedef EmptyMessageSearchBuilder = Widget Function(
|
typedef EmptyMessageSearchBuilder = Widget Function(
|
||||||
BuildContext context, String searchQuery);
|
BuildContext context, String searchQuery);
|
||||||
|
|
||||||
@@ -44,9 +43,9 @@ typedef EmptyMessageSearchBuilder = Widget Function(
|
|||||||
///
|
///
|
||||||
/// The widget components render the ui based on the first ancestor of type [StreamChatTheme].
|
/// The widget components render the ui based on the first ancestor of type [StreamChatTheme].
|
||||||
/// Modify it to change the widget appearance.
|
/// Modify it to change the widget appearance.
|
||||||
class MessageSearchListView extends StatefulWidget {
|
class MessageSearchListViewCore extends StatefulWidget {
|
||||||
/// Instantiate a new MessageSearchListView
|
/// Instantiate a new MessageSearchListView
|
||||||
const MessageSearchListView({
|
const MessageSearchListViewCore({
|
||||||
Key key,
|
Key key,
|
||||||
this.messageQuery,
|
this.messageQuery,
|
||||||
this.filters,
|
this.filters,
|
||||||
@@ -98,10 +97,11 @@ class MessageSearchListView extends StatefulWidget {
|
|||||||
final WidgetBuilder loadingBuilder;
|
final WidgetBuilder loadingBuilder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MessageSearchListViewState createState() => _MessageSearchListViewState();
|
_MessageSearchListViewCoreState createState() =>
|
||||||
|
_MessageSearchListViewCoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MessageSearchListViewState extends State<MessageSearchListView> {
|
class _MessageSearchListViewCoreState extends State<MessageSearchListViewCore> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -167,7 +167,7 @@ class _MessageSearchListViewState extends State<MessageSearchListView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didUpdateWidget(MessageSearchListView oldWidget) {
|
void didUpdateWidget(MessageSearchListViewCore oldWidget) {
|
||||||
super.didUpdateWidget(oldWidget);
|
super.didUpdateWidget(oldWidget);
|
||||||
if (widget.filters?.toString() != oldWidget.filters?.toString() ||
|
if (widget.filters?.toString() != oldWidget.filters?.toString() ||
|
||||||
jsonEncode(widget.sortOptions) != jsonEncode(oldWidget.sortOptions) ||
|
jsonEncode(widget.sortOptions) != jsonEncode(oldWidget.sortOptions) ||
|
||||||
+10
-9
@@ -24,12 +24,12 @@ import 'package:stream_chat/stream_chat.dart';
|
|||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// Use [StreamChat.of] to get the current [StreamChatState] instance.
|
/// Use [StreamChatCore.of] to get the current [StreamChatCoreState] instance.
|
||||||
class StreamChat extends StatefulWidget {
|
class StreamChatCore extends StatefulWidget {
|
||||||
final Client client;
|
final Client client;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
StreamChat({
|
StreamChatCore({
|
||||||
Key key,
|
Key key,
|
||||||
@required this.client,
|
@required this.client,
|
||||||
@required this.child,
|
@required this.child,
|
||||||
@@ -38,13 +38,13 @@ class StreamChat extends StatefulWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
StreamChatState createState() => StreamChatState();
|
StreamChatCoreState createState() => StreamChatCoreState();
|
||||||
|
|
||||||
/// Use this method to get the current [StreamChatState] instance
|
/// Use this method to get the current [StreamChatCoreState] instance
|
||||||
static StreamChatState of(BuildContext context) {
|
static StreamChatCoreState of(BuildContext context) {
|
||||||
StreamChatState streamChatState;
|
StreamChatCoreState streamChatState;
|
||||||
|
|
||||||
streamChatState = context.findAncestorStateOfType<StreamChatState>();
|
streamChatState = context.findAncestorStateOfType<StreamChatCoreState>();
|
||||||
|
|
||||||
if (streamChatState == null) {
|
if (streamChatState == null) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
@@ -56,7 +56,8 @@ class StreamChat extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The current state of the StreamChat widget
|
/// The current state of the StreamChat widget
|
||||||
class StreamChatState extends State<StreamChat> with WidgetsBindingObserver {
|
class StreamChatCoreState extends State<StreamChatCore>
|
||||||
|
with WidgetsBindingObserver {
|
||||||
Client get client => widget.client;
|
Client get client => widget.client;
|
||||||
Timer _disconnectTimer;
|
Timer _disconnectTimer;
|
||||||
|
|
||||||
+5
-5
@@ -35,9 +35,9 @@ import 'package:stream_chat_flutter_core/src/users_bloc.dart';
|
|||||||
///
|
///
|
||||||
/// The widget components render the ui based on the first ancestor of type [StreamChatTheme].
|
/// The widget components render the ui based on the first ancestor of type [StreamChatTheme].
|
||||||
/// Modify it to change the widget appearance.
|
/// Modify it to change the widget appearance.
|
||||||
class UserListView extends StatefulWidget {
|
class UserListViewCore extends StatefulWidget {
|
||||||
/// Instantiate a new UserListView
|
/// Instantiate a new UserListView
|
||||||
const UserListView({
|
const UserListViewCore({
|
||||||
Key key,
|
Key key,
|
||||||
this.filter,
|
this.filter,
|
||||||
this.options,
|
this.options,
|
||||||
@@ -98,10 +98,10 @@ class UserListView extends StatefulWidget {
|
|||||||
final bool groupAlphabetically;
|
final bool groupAlphabetically;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_UserListViewState createState() => _UserListViewState();
|
_UserListViewCoreState createState() => _UserListViewCoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _UserListViewState extends State<UserListView>
|
class _UserListViewCoreState extends State<UserListViewCore>
|
||||||
with WidgetsBindingObserver {
|
with WidgetsBindingObserver {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -217,7 +217,7 @@ class _UserListViewState extends State<UserListView>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didUpdateWidget(UserListView oldWidget) {
|
void didUpdateWidget(UserListViewCore oldWidget) {
|
||||||
super.didUpdateWidget(oldWidget);
|
super.didUpdateWidget(oldWidget);
|
||||||
if (widget.filter?.toString() != oldWidget.filter?.toString() ||
|
if (widget.filter?.toString() != oldWidget.filter?.toString() ||
|
||||||
jsonEncode(widget.sort) != jsonEncode(oldWidget.sort) ||
|
jsonEncode(widget.sort) != jsonEncode(oldWidget.sort) ||
|
||||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
import 'package:stream_chat/stream_chat.dart';
|
import 'package:stream_chat/stream_chat.dart';
|
||||||
|
|
||||||
import 'stream_chat.dart';
|
import 'stream_chat_core.dart';
|
||||||
|
|
||||||
/// Widget dedicated to the management of a users list with pagination
|
/// Widget dedicated to the management of a users list with pagination
|
||||||
class UsersBloc extends StatefulWidget {
|
class UsersBloc extends StatefulWidget {
|
||||||
@@ -56,7 +56,7 @@ class UsersBlocState extends State<UsersBloc>
|
|||||||
Map<String, dynamic> options,
|
Map<String, dynamic> options,
|
||||||
PaginationParams pagination,
|
PaginationParams pagination,
|
||||||
}) async {
|
}) async {
|
||||||
final client = StreamChat.of(context).client;
|
final client = StreamChatCore.of(context).client;
|
||||||
|
|
||||||
if (client.state?.user == null ||
|
if (client.state?.user == null ||
|
||||||
_queryUsersLoadingController.value == true) {
|
_queryUsersLoadingController.value == true) {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
library stream_chat_flutter_core;
|
library stream_chat_flutter_core;
|
||||||
|
|
||||||
export 'src/channel_list_view.dart';
|
export 'src/channel_list_view_core.dart';
|
||||||
export 'src/channels_bloc.dart';
|
export 'src/channels_bloc.dart';
|
||||||
export 'src/lazy_load_scroll_view.dart';
|
export 'src/lazy_load_scroll_view.dart';
|
||||||
export 'src/message_list_view.dart';
|
export 'src/message_list_view_core.dart';
|
||||||
export 'src/message_search_bloc.dart';
|
export 'src/message_search_bloc.dart';
|
||||||
export 'src/message_search_list_view.dart';
|
export 'src/message_search_list_view_core.dart';
|
||||||
export 'src/stream_channel.dart';
|
export 'src/stream_channel.dart';
|
||||||
export 'src/stream_chat.dart';
|
export 'src/stream_chat_core.dart';
|
||||||
export 'src/user_list_view.dart';
|
export 'src/user_list_view_core.dart';
|
||||||
export 'src/users_bloc.dart';
|
export 'src/users_bloc.dart';
|
||||||
|
|||||||
Reference in New Issue
Block a user