rfac: Added core prefixes

This commit is contained in:
Deven Joshi
2021-01-25 12:54:55 +05:30
parent b6aa030d81
commit c5caf5bfc3
9 changed files with 48 additions and 47 deletions
@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'package:stream_chat/stream_chat.dart';
import 'package:stream_chat_flutter_core/src/channels_bloc.dart';
import 'stream_chat.dart';
import 'stream_chat_core.dart';
/// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_list_view.png)
/// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_list_view_paint.png)
@@ -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 components render the ui based on the first ancestor of type [StreamChatTheme].
/// Modify it to change the widget appearance.
class ChannelListView extends StatefulWidget {
class ChannelListViewCore extends StatefulWidget {
/// Instantiate a new ChannelListView
ChannelListView({
ChannelListViewCore({
Key key,
this.filter,
this.options,
@@ -96,10 +96,10 @@ class ChannelListView extends StatefulWidget {
final bool pullToRefresh;
@override
_ChannelListViewState createState() => _ChannelListViewState();
_ChannelListViewCoreState createState() => _ChannelListViewCoreState();
}
class _ChannelListViewState extends State<ChannelListView>
class _ChannelListViewCoreState extends State<ChannelListViewCore>
with WidgetsBindingObserver {
@override
Widget build(BuildContext context) {
@@ -197,7 +197,7 @@ class _ChannelListViewState extends State<ChannelListView>
options: widget.options,
);
final client = StreamChat.of(context).client;
final client = StreamChatCore.of(context).client;
_subscription = client
.on(
@@ -221,7 +221,7 @@ class _ChannelListViewState extends State<ChannelListView>
}
@override
void didUpdateWidget(ChannelListView oldWidget) {
void didUpdateWidget(ChannelListViewCore oldWidget) {
super.didUpdateWidget(oldWidget);
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 {
VoidCallback paginateData;
}
@@ -3,7 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:rxdart/rxdart.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
class ChannelsBloc extends StatefulWidget {
@@ -79,7 +79,7 @@ class ChannelsBlocState extends State<ChannelsBloc>
Map<String, dynamic> options,
bool onlyOffline = false,
}) async {
final client = StreamChat.of(context).client;
final client = StreamChatCore.of(context).client;
if (client.state?.user == null ||
_queryChannelsLoadingController.value == true) {
@@ -120,7 +120,7 @@ class ChannelsBlocState extends State<ChannelsBloc>
void initState() {
super.initState();
final client = StreamChat.of(context).client;
final client = StreamChatCore.of(context).client;
if (!widget.lockChannelsOrder) {
_subscriptions.add(client.on(EventType.messageNew).listen((e) {
@@ -45,9 +45,9 @@ import 'stream_channel.dart';
///
/// The widget components render the ui based on the first ancestor of type [StreamChatTheme].
/// Modify it to change the widget appearance.
class MessageListView extends StatefulWidget {
class MessageListViewCore extends StatefulWidget {
/// Instantiate a new MessageListView
MessageListView({
MessageListViewCore({
Key key,
this.showScrollToBottom = true,
this.parentMessage,
@@ -58,7 +58,7 @@ class MessageListView extends StatefulWidget {
this.messageListController,
}) : super(key: key);
MessageListController messageListController;
final MessageListController messageListController;
final Widget Function(BuildContext, List<Message>) messageListBuilder;
@@ -78,10 +78,10 @@ class MessageListView extends StatefulWidget {
final Widget Function(DateTime) dateDividerBuilder;
@override
_MessageListViewState createState() => _MessageListViewState();
_MessageListViewCoreState createState() => _MessageListViewCoreState();
}
class _MessageListViewState extends State<MessageListView> {
class _MessageListViewCoreState extends State<MessageListViewCore> {
StreamChannelState streamChannel;
bool get _upToDate => streamChannel.channel.state.isUpToDate;
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:rxdart/rxdart.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
class MessageSearchBloc extends StatefulWidget {
@@ -122,7 +122,7 @@ class MessageSearchBlocState extends State<MessageSearchBloc>
String query,
PaginationParams pagination,
}) {
final client = StreamChat.of(context).client;
final client = StreamChatCore.of(context).client;
return client.search(
filter,
sort,
@@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:stream_chat/stream_chat.dart';
import 'lazy_load_scroll_view.dart';
import 'message_search_bloc.dart';
/// Callback called when tapping on a user
@@ -12,7 +11,7 @@ typedef MessageSearchItemTapCallback = void Function(GetMessageResponse);
typedef MessageSearchItemBuilder = Widget Function(
BuildContext, GetMessageResponse);
/// Builder used when [MessageSearchListView] is empty
/// Builder used when [MessageSearchListViewCore] is empty
typedef EmptyMessageSearchBuilder = Widget Function(
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].
/// Modify it to change the widget appearance.
class MessageSearchListView extends StatefulWidget {
class MessageSearchListViewCore extends StatefulWidget {
/// Instantiate a new MessageSearchListView
const MessageSearchListView({
const MessageSearchListViewCore({
Key key,
this.messageQuery,
this.filters,
@@ -98,10 +97,11 @@ class MessageSearchListView extends StatefulWidget {
final WidgetBuilder loadingBuilder;
@override
_MessageSearchListViewState createState() => _MessageSearchListViewState();
_MessageSearchListViewCoreState createState() =>
_MessageSearchListViewCoreState();
}
class _MessageSearchListViewState extends State<MessageSearchListView> {
class _MessageSearchListViewCoreState extends State<MessageSearchListViewCore> {
@override
void initState() {
super.initState();
@@ -167,7 +167,7 @@ class _MessageSearchListViewState extends State<MessageSearchListView> {
}
@override
void didUpdateWidget(MessageSearchListView oldWidget) {
void didUpdateWidget(MessageSearchListViewCore oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.filters?.toString() != oldWidget.filters?.toString() ||
jsonEncode(widget.sortOptions) != jsonEncode(oldWidget.sortOptions) ||
@@ -24,12 +24,12 @@ import 'package:stream_chat/stream_chat.dart';
/// }
/// }
///
/// Use [StreamChat.of] to get the current [StreamChatState] instance.
class StreamChat extends StatefulWidget {
/// Use [StreamChatCore.of] to get the current [StreamChatCoreState] instance.
class StreamChatCore extends StatefulWidget {
final Client client;
final Widget child;
StreamChat({
StreamChatCore({
Key key,
@required this.client,
@required this.child,
@@ -38,13 +38,13 @@ class StreamChat extends StatefulWidget {
);
@override
StreamChatState createState() => StreamChatState();
StreamChatCoreState createState() => StreamChatCoreState();
/// Use this method to get the current [StreamChatState] instance
static StreamChatState of(BuildContext context) {
StreamChatState streamChatState;
/// Use this method to get the current [StreamChatCoreState] instance
static StreamChatCoreState of(BuildContext context) {
StreamChatCoreState streamChatState;
streamChatState = context.findAncestorStateOfType<StreamChatState>();
streamChatState = context.findAncestorStateOfType<StreamChatCoreState>();
if (streamChatState == null) {
throw Exception(
@@ -56,7 +56,8 @@ class StreamChat extends StatefulWidget {
}
/// 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;
Timer _disconnectTimer;
@@ -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].
/// Modify it to change the widget appearance.
class UserListView extends StatefulWidget {
class UserListViewCore extends StatefulWidget {
/// Instantiate a new UserListView
const UserListView({
const UserListViewCore({
Key key,
this.filter,
this.options,
@@ -98,10 +98,10 @@ class UserListView extends StatefulWidget {
final bool groupAlphabetically;
@override
_UserListViewState createState() => _UserListViewState();
_UserListViewCoreState createState() => _UserListViewCoreState();
}
class _UserListViewState extends State<UserListView>
class _UserListViewCoreState extends State<UserListViewCore>
with WidgetsBindingObserver {
@override
void initState() {
@@ -217,7 +217,7 @@ class _UserListViewState extends State<UserListView>
}
@override
void didUpdateWidget(UserListView oldWidget) {
void didUpdateWidget(UserListViewCore oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.filter?.toString() != oldWidget.filter?.toString() ||
jsonEncode(widget.sort) != jsonEncode(oldWidget.sort) ||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:rxdart/rxdart.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
class UsersBloc extends StatefulWidget {
@@ -56,7 +56,7 @@ class UsersBlocState extends State<UsersBloc>
Map<String, dynamic> options,
PaginationParams pagination,
}) async {
final client = StreamChat.of(context).client;
final client = StreamChatCore.of(context).client;
if (client.state?.user == null ||
_queryUsersLoadingController.value == true) {
@@ -1,12 +1,12 @@
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/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_list_view.dart';
export 'src/message_search_list_view_core.dart';
export 'src/stream_channel.dart';
export 'src/stream_chat.dart';
export 'src/user_list_view.dart';
export 'src/stream_chat_core.dart';
export 'src/user_list_view_core.dart';
export 'src/users_bloc.dart';