Merge remote-tracking branch 'origin/feat/pin-message' into feat/pin-message
This commit is contained in:
@@ -67,6 +67,8 @@ class StreamExample extends StatelessWidget {
|
||||
/// [ChannelListCore] is a `builder` with callbacks for constructing UIs based
|
||||
/// on different scenarios.
|
||||
class HomeScreen extends StatelessWidget {
|
||||
final channelListController = ChannelListController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -75,6 +77,15 @@ class HomeScreen extends StatelessWidget {
|
||||
),
|
||||
body: ChannelsBloc(
|
||||
child: ChannelListCore(
|
||||
channelListController: channelListController,
|
||||
filter: {
|
||||
'type': 'messaging',
|
||||
'members': {
|
||||
r'$in': [
|
||||
StreamChatCore.of(context).user.id,
|
||||
]
|
||||
}
|
||||
},
|
||||
emptyBuilder: (BuildContext context) {
|
||||
return Center(
|
||||
child: Text('Looks like you are not in any channels'),
|
||||
@@ -99,7 +110,11 @@ class HomeScreen extends StatelessWidget {
|
||||
BuildContext context,
|
||||
List<Channel> channels,
|
||||
) =>
|
||||
ListView.builder(
|
||||
LazyLoadScrollView(
|
||||
onEndOfPage: () async {
|
||||
channelListController.paginateData();
|
||||
},
|
||||
child: ListView.builder(
|
||||
itemCount: channels.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final _item = channels[index];
|
||||
@@ -127,6 +142,7 @@ class HomeScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,10 @@ class ChannelListCore extends StatefulWidget {
|
||||
this.filter,
|
||||
this.options,
|
||||
this.sort,
|
||||
this.pagination,
|
||||
this.pagination = const PaginationParams(
|
||||
offset: 0,
|
||||
limit: 25,
|
||||
),
|
||||
this.channelListController,
|
||||
}) : assert(errorBuilder != null),
|
||||
assert(emptyBuilder != null),
|
||||
|
||||
Reference in New Issue
Block a user