add channels_bloc

This commit is contained in:
Salvatore Giordano
2020-04-07 15:23:23 +02:00
parent fafafb8c44
commit e0fde25b24
5 changed files with 166 additions and 140 deletions
+16 -34
View File
@@ -50,50 +50,32 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
home: Container(
child: ChannelListPage(client),
child: StreamChat(
client: client,
child: ChannelListPage(),
),
),
);
}
}
class ChannelListPage extends StatelessWidget {
final Client client;
ChannelListPage(this.client);
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageView(
children: <Widget>[
StreamChat(
client: client,
child: Builder(
builder: (context) => ChannelListView(
filter: {
'members': {
'\$in': [StreamChat.of(context).user.id],
}
},
sort: [SortOption('last_message_at')],
pagination: PaginationParams(
limit: 20,
),
channelWidget: ChannelPage(),
),
),
body: ChannelsBloc(
child: ChannelListView(
filter: {
'members': {
'\$in': [StreamChat.of(context).user.id],
}
},
sort: [SortOption('last_message_at')],
pagination: PaginationParams(
limit: 20,
),
StreamChat(
client: client,
child: ChannelListView(
sort: [SortOption('last_message_at')],
pagination: PaginationParams(
limit: 20,
),
channelWidget: ChannelPage(),
),
),
],
channelWidget: ChannelPage(),
),
),
);
}