feat: Added new docs
This commit is contained in:
@@ -4,3 +4,40 @@ sidebar_position: 5
|
|||||||
title: MessageListView
|
title: MessageListView
|
||||||
---
|
---
|
||||||
|
|
||||||
|
The MessageListView shows the list of messages of the current channel.
|
||||||
|
|
||||||
|
```dart
|
||||||
|
class ChannelPage extends StatelessWidget {
|
||||||
|
const ChannelPage({
|
||||||
|
Key key,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: ChannelHeader(),
|
||||||
|
body: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: MessageListView(
|
||||||
|
threadBuilder: (_, parentMessage) {
|
||||||
|
return ThreadPage(
|
||||||
|
parent: parentMessage,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MessageInput(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure to have a [StreamChannel] 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].
|
||||||
@@ -4,3 +4,52 @@ sidebar_position: 4
|
|||||||
title: ChannelListCore
|
title: ChannelListCore
|
||||||
---
|
---
|
||||||
|
|
||||||
|
`ChannelListCore` is a simplified class that allows fetching a list of
|
||||||
|
channels while exposing UI builders.
|
||||||
|
|
||||||
|
This allows you to construct your own UI while not having to
|
||||||
|
worry about the specific logic of fetching channels in your app.
|
||||||
|
|
||||||
|
A `ChannelListController` is used to reload and paginate data.
|
||||||
|
|
||||||
|
```dart
|
||||||
|
class ChannelListPage extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: ChannelListCore(
|
||||||
|
filter: {
|
||||||
|
'members': {
|
||||||
|
'\$in': [StreamChat.of(context).user.id],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sort: [SortOption('last_message_at')],
|
||||||
|
pagination: PaginationParams(
|
||||||
|
limit: 20,
|
||||||
|
),
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure to have a `StreamChatCore` ancestor in order to provide the
|
||||||
|
information about the channels.
|
||||||
@@ -3,3 +3,54 @@ id: message_list_core
|
|||||||
sidebar_position: 5
|
sidebar_position: 5
|
||||||
title: MessageListCore
|
title: MessageListCore
|
||||||
---
|
---
|
||||||
|
|
||||||
|
`MessageListCore` is a simplified class that allows fetching a list of
|
||||||
|
messages while exposing UI builders.
|
||||||
|
|
||||||
|
This allows you to construct your own UI while not having to
|
||||||
|
worry about the specific logic of fetching messages in a channel.
|
||||||
|
|
||||||
|
A `MessageListController` is used to paginate data.
|
||||||
|
|
||||||
|
```dart
|
||||||
|
class ChannelPage extends StatelessWidget {
|
||||||
|
const ChannelPage({
|
||||||
|
Key key,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: MessageListCore(
|
||||||
|
emptyBuilder: (context) {
|
||||||
|
return Center(
|
||||||
|
child: Text('Nothing here...'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
loadingBuilder: (context) {
|
||||||
|
return Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
messageListBuilder: (context, list) {
|
||||||
|
return MessagesPage(list);
|
||||||
|
},
|
||||||
|
errorWidgetBuilder: (context, err) {
|
||||||
|
return Center(
|
||||||
|
child: Text('Error'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure to have a `StreamChannel` ancestor in order to provide the
|
||||||
|
information about the channels.
|
||||||
@@ -3,3 +3,30 @@ id: message_search_list_core
|
|||||||
sidebar_position: 6
|
sidebar_position: 6
|
||||||
title: MessageSearchListCore
|
title: MessageSearchListCore
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
`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
|
||||||
|
class MessageSearchPage extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: MessageSearchListCore(
|
||||||
|
messageQuery: _channelQuery,
|
||||||
|
filters: {
|
||||||
|
'members': {
|
||||||
|
r'$in': [user.id]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
paginationParams: PaginationParams(limit: 20),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure to have a `MessageSearchBloc` ancestor in order to provide the
|
||||||
|
information about the messages.
|
||||||
Reference in New Issue
Block a user