chore: Remove unnecessary stream subscriptions

This commit is contained in:
Christian Pauly 2022-08-10 21:15:13 +02:00
parent 5b96bfd83a
commit 874da53684

View File

@ -88,12 +88,6 @@ class StoriesHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
final client = Matrix.of(context).client;
return StreamBuilder(
stream: Matrix.of(context).onShareContentChanged.stream,
builder: (context, _) => StreamBuilder<Object>(
stream: client.onSync.stream
.where((syncUpdate) => syncUpdate.hasRoomUpdate),
builder: (context, snapshot) {
if (Matrix.of(context).shareContent != null) {
return ListTile(
leading: CircleAvatar(
@ -107,9 +101,8 @@ class StoriesHeader extends StatelessWidget {
);
}
if (client.storiesRooms.isEmpty ||
!client.storiesRooms.any((room) => room.displayname
.toLowerCase()
.contains(filter.toLowerCase()))) {
!client.storiesRooms.any((room) =>
room.displayname.toLowerCase().contains(filter.toLowerCase()))) {
return Container();
}
final ownStoryRoom = client.storiesRooms
@ -134,9 +127,7 @@ class StoriesHeader extends StatelessWidget {
userId?.localpart ??
'Unknown';
final avatarUrl = snapshot.data?.avatarUrl;
if (!displayname
.toLowerCase()
.contains(filter.toLowerCase())) {
if (!displayname.toLowerCase().contains(filter.toLowerCase())) {
return Container();
}
return _StoryButton(
@ -151,15 +142,12 @@ class StoriesHeader extends StatelessWidget {
unread: room.membership == Membership.invite ||
(room.hasNewMessages && room.hasPosts),
onPressed: () => _goToStoryAction(context, room.id),
onLongPressed: () =>
_contextualActions(context, room),
onLongPressed: () => _contextualActions(context, room),
);
});
},
),
);
}),
);
}
}