doc: Added some docs for core code
This commit is contained in:
@@ -11,14 +11,15 @@ import 'stream_chat_core.dart';
|
|||||||
/// 
|
/// 
|
||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
/// It shows the list of current channels.
|
/// [ChannelListCore] is a simplified class that allows fetching a list of channels while exposing UI builders.
|
||||||
|
/// A [ChannelListController] is used to reload and paginate data.
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class ChannelListPage extends StatelessWidget {
|
/// class ChannelListPage extends StatelessWidget {
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// body: ChannelListView(
|
/// body: ChannelListCore(
|
||||||
/// filter: {
|
/// filter: {
|
||||||
/// 'members': {
|
/// 'members': {
|
||||||
/// '\$in': [StreamChat.of(context).user.id],
|
/// '\$in': [StreamChat.of(context).user.id],
|
||||||
@@ -28,7 +29,24 @@ import 'stream_chat_core.dart';
|
|||||||
/// pagination: PaginationParams(
|
/// pagination: PaginationParams(
|
||||||
/// limit: 20,
|
/// limit: 20,
|
||||||
/// ),
|
/// ),
|
||||||
/// channelWidget: ChannelPage(),
|
/// errorBuilder: (err) {
|
||||||
|
/// return Center(
|
||||||
|
/// child: Text('An error has occured'),
|
||||||
|
/// );
|
||||||
|
/// },
|
||||||
|
/// emptyBuilder: (context) {
|
||||||
|
/// return Center(
|
||||||
|
/// child: Text('Nothing here...'),
|
||||||
|
/// );
|
||||||
|
/// },
|
||||||
|
/// emptyBuilder: (context) {
|
||||||
|
/// return Center(
|
||||||
|
/// child: CircularProgressIndicator(),
|
||||||
|
/// );
|
||||||
|
/// },
|
||||||
|
/// listBuilder: (context, list) {
|
||||||
|
/// return ChannelPage(list);
|
||||||
|
/// }
|
||||||
/// ),
|
/// ),
|
||||||
/// );
|
/// );
|
||||||
/// }
|
/// }
|
||||||
@@ -37,10 +55,6 @@ import 'stream_chat_core.dart';
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// Make sure to have a [StreamChatCore] 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 ChannelListCore extends StatefulWidget {
|
class ChannelListCore extends StatefulWidget {
|
||||||
/// Instantiate a new ChannelListView
|
/// Instantiate a new ChannelListView
|
||||||
ChannelListCore({
|
ChannelListCore({
|
||||||
@@ -56,13 +70,17 @@ class ChannelListCore extends StatefulWidget {
|
|||||||
this.channelListController,
|
this.channelListController,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
/// A [ChannelListController] allows reloading and pagination.
|
||||||
|
/// Use [ChannelListController.loadData] and [ChannelListController.paginateData] respectively for reloading and pagination.
|
||||||
final ChannelListController channelListController;
|
final ChannelListController channelListController;
|
||||||
|
|
||||||
/// The builder that will be used in case of error
|
/// The builder that will be used in case of error
|
||||||
final Widget Function(Error error) errorBuilder;
|
final Widget Function(Error error) errorBuilder;
|
||||||
|
|
||||||
|
/// The builder that will be used in case of loading
|
||||||
final WidgetBuilder loadingBuilder;
|
final WidgetBuilder loadingBuilder;
|
||||||
|
|
||||||
|
/// The builder which is used when list of channels loads
|
||||||
final Function(BuildContext, List<Channel>) listBuilder;
|
final Function(BuildContext, List<Channel>) listBuilder;
|
||||||
|
|
||||||
/// The builder used when the channel list is empty.
|
/// The builder used when the channel list is empty.
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ import 'stream_channel.dart';
|
|||||||
/// 
|
/// 
|
||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
/// It shows the list of messages of the current channel.
|
/// [MessageListCore] is a simplified class that allows fetching a list of messages while exposing UI builders.
|
||||||
|
/// A [MessageListController] is used to paginate data.
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class ChannelPage extends StatelessWidget {
|
/// class ChannelPage extends StatelessWidget {
|
||||||
@@ -19,19 +20,25 @@ import 'stream_channel.dart';
|
|||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// appBar: ChannelHeader(),
|
|
||||||
/// body: Column(
|
/// body: Column(
|
||||||
/// children: <Widget>[
|
/// children: <Widget>[
|
||||||
/// Expanded(
|
/// Expanded(
|
||||||
/// child: MessageListView(
|
/// child: MessageListCore(
|
||||||
/// threadBuilder: (_, parentMessage) {
|
/// emptyBuilder: (context) {
|
||||||
/// return ThreadPage(
|
/// return Center(
|
||||||
/// parent: parentMessage,
|
/// child: Text('Nothing here...'),
|
||||||
/// );
|
/// );
|
||||||
/// },
|
/// },
|
||||||
|
/// emptyBuilder: (context) {
|
||||||
|
/// return Center(
|
||||||
|
/// child: CircularProgressIndicator(),
|
||||||
|
/// );
|
||||||
|
/// },
|
||||||
|
/// messageListBuilder: (context, list) {
|
||||||
|
/// return MessagesPage(list);
|
||||||
|
/// }
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// MessageInput(),
|
|
||||||
/// ],
|
/// ],
|
||||||
/// ),
|
/// ),
|
||||||
/// );
|
/// );
|
||||||
@@ -57,6 +64,8 @@ class MessageListCore extends StatefulWidget {
|
|||||||
this.messageListController,
|
this.messageListController,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
/// A [MessageListController] allows pagination.
|
||||||
|
/// Use [ChannelListController.paginateData] pagination.
|
||||||
final MessageListController messageListController;
|
final MessageListController messageListController;
|
||||||
|
|
||||||
final Widget Function(BuildContext, List<Message>) messageListBuilder;
|
final Widget Function(BuildContext, List<Message>) messageListBuilder;
|
||||||
|
|||||||
@@ -5,14 +5,15 @@ import 'package:stream_chat/stream_chat.dart';
|
|||||||
import 'message_search_bloc.dart';
|
import 'message_search_bloc.dart';
|
||||||
|
|
||||||
///
|
///
|
||||||
/// It shows the list of searched messages.
|
/// [MessageSearchListCore] is a simplified class that allows searching for messages across channels while exposing UI builders.
|
||||||
|
/// A [MessageSearchListController] is used to load and paginate data.
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class MessageSearchPage extends StatelessWidget {
|
/// class MessageSearchPage extends StatelessWidget {
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// body: MessageSearchListView(
|
/// body: MessageSearchListCore(
|
||||||
/// messageQuery: _channelQuery,
|
/// messageQuery: _channelQuery,
|
||||||
/// filters: {
|
/// filters: {
|
||||||
/// 'members': {
|
/// 'members': {
|
||||||
@@ -48,6 +49,8 @@ class MessageSearchListCore extends StatefulWidget {
|
|||||||
this.messageSearchListController,
|
this.messageSearchListController,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
/// A [MessageSearchListController] allows reloading and pagination.
|
||||||
|
/// Use [MessageSearchListController.loadData] and [MessageSearchListController.paginateData] respectively for reloading and pagination.
|
||||||
final MessageSearchListController messageSearchListController;
|
final MessageSearchListController messageSearchListController;
|
||||||
|
|
||||||
/// Message String to search on
|
/// Message String to search on
|
||||||
@@ -75,6 +78,7 @@ class MessageSearchListCore extends StatefulWidget {
|
|||||||
/// You can also filter other built-in channel fields.
|
/// You can also filter other built-in channel fields.
|
||||||
final Map<String, dynamic> messageFilters;
|
final Map<String, dynamic> messageFilters;
|
||||||
|
|
||||||
|
/// The builder that is used when the search messages are fetched
|
||||||
final Widget Function(List<GetMessageResponse>) childBuilder;
|
final Widget Function(List<GetMessageResponse>) childBuilder;
|
||||||
|
|
||||||
/// The builder used when the channel list is empty.
|
/// The builder used when the channel list is empty.
|
||||||
@@ -83,6 +87,7 @@ class MessageSearchListCore extends StatefulWidget {
|
|||||||
/// The builder that will be used in case of error
|
/// The builder that will be used in case of error
|
||||||
final Widget Function(Error error) errorBuilder;
|
final Widget Function(Error error) errorBuilder;
|
||||||
|
|
||||||
|
/// The builder that will be used in case of loading
|
||||||
final WidgetBuilder loadingBuilder;
|
final WidgetBuilder loadingBuilder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -5,14 +5,15 @@ import 'package:stream_chat/stream_chat.dart';
|
|||||||
import 'package:stream_chat_flutter_core/src/users_bloc.dart';
|
import 'package:stream_chat_flutter_core/src/users_bloc.dart';
|
||||||
|
|
||||||
///
|
///
|
||||||
/// It shows the list of current users.
|
/// [UserListCore] is a simplified class that allows fetching users while exposing UI builders.
|
||||||
|
/// A [UserListController] is used to load and paginate data.
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class UsersListPage extends StatelessWidget {
|
/// class UsersListPage extends StatelessWidget {
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// body: UsersListView(
|
/// body: UsersListCore(
|
||||||
/// filter: {
|
/// filter: {
|
||||||
/// 'members': {
|
/// 'members': {
|
||||||
/// '\$in': [StreamChat.of(context).user.id],
|
/// '\$in': [StreamChat.of(context).user.id],
|
||||||
@@ -22,7 +23,24 @@ import 'package:stream_chat_flutter_core/src/users_bloc.dart';
|
|||||||
/// pagination: PaginationParams(
|
/// pagination: PaginationParams(
|
||||||
/// limit: 20,
|
/// limit: 20,
|
||||||
/// ),
|
/// ),
|
||||||
/// channelWidget: ChannelPage(),
|
/// errorBuilder: (err) {
|
||||||
|
/// return Center(
|
||||||
|
/// child: Text('An error has occured'),
|
||||||
|
/// );
|
||||||
|
/// },
|
||||||
|
/// emptyBuilder: (context) {
|
||||||
|
/// return Center(
|
||||||
|
/// child: Text('Nothing here...'),
|
||||||
|
/// );
|
||||||
|
/// },
|
||||||
|
/// emptyBuilder: (context) {
|
||||||
|
/// return Center(
|
||||||
|
/// child: CircularProgressIndicator(),
|
||||||
|
/// );
|
||||||
|
/// },
|
||||||
|
/// listBuilder: (context, list) {
|
||||||
|
/// return UsersPage(list);
|
||||||
|
/// }
|
||||||
/// ),
|
/// ),
|
||||||
/// );
|
/// );
|
||||||
/// }
|
/// }
|
||||||
@@ -51,6 +69,8 @@ class UserListCore extends StatefulWidget {
|
|||||||
this.userListController,
|
this.userListController,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
/// A [UserListController] allows reloading and pagination.
|
||||||
|
/// Use [UserListController.loadData] and [UserListController.paginateData] respectively for reloading and pagination.
|
||||||
final UserListController userListController;
|
final UserListController userListController;
|
||||||
|
|
||||||
/// The builder that will be used in case of error
|
/// The builder that will be used in case of error
|
||||||
|
|||||||
Reference in New Issue
Block a user