fix analysis and update examples

This commit is contained in:
Salvatore Giordano
2022-02-01 10:52:59 +01:00
parent d959131bbd
commit f53ee0b4f1
15 changed files with 223 additions and 164 deletions
@@ -84,7 +84,7 @@ class _SplitViewState extends State<SplitView> {
);
}
class ChannelListPage extends StatelessWidget {
class ChannelListPage extends StatefulWidget {
const ChannelListPage({
Key? key,
this.onTap,
@@ -92,22 +92,26 @@ class ChannelListPage extends StatelessWidget {
final void Function(Channel)? onTap;
@override
State<ChannelListPage> createState() => _ChannelListPageState();
}
class _ChannelListPageState extends State<ChannelListPage> {
late final _listController = StreamChannelListController(
client: StreamChat.of(context).client,
filter: Filter.in_(
'members',
[StreamChat.of(context).currentUser!.id],
),
sort: const [SortOption('last_message_at')],
limit: 20,
);
@override
Widget build(BuildContext context) => Scaffold(
body: ChannelsBloc(
child: ChannelListView(
onChannelTap: onTap != null
? (channel, _) {
onTap!(channel);
}
: null,
filter: Filter.in_(
'members',
[StreamChat.of(context).currentUser!.id],
),
sort: const [SortOption('last_message_at')],
limit: 20,
),
body: StreamChannelListView(
onChannelTap: widget.onTap,
controller: _listController,
),
);
}