Merge pull request #715 from GetStream/hotfix/floatingDateStream

fix(ui): fix floating date stream subscription
This commit is contained in:
Salvatore Giordano
2021-10-01 13:55:14 +02:00
committed by GitHub
2 changed files with 3 additions and 4 deletions
@@ -3,6 +3,7 @@
🐞 Fixed
-[[#687]](https://github.com/GetStream/stream-chat-flutter/issues/687): Fix Users losing their place in the conversation after replying in threads.
- Fixed floating date stream subscription causing "Bad state: stream has already been listened.” error.
✅ Added
@@ -293,7 +293,6 @@ class _MessageListViewState extends State<MessageListView> {
void Function(Message)? _onThreadTap;
bool _showScrollToBottom = false;
late final ItemPositionsListener _itemPositionListener;
late final Stream<Iterable<ItemPosition>> _itemPositionStream;
int? _messageListLength;
StreamChannelState? streamChannel;
late StreamChatThemeData _streamTheme;
@@ -665,7 +664,8 @@ class _MessageListViewState extends State<MessageListView> {
right: 0,
child: BetterStreamBuilder<Iterable<ItemPosition>>(
initialData: _itemPositionListener.itemPositions.value,
stream: _itemPositionStream,
stream: _valueListenableToStreamAdapter(
_itemPositionListener.itemPositions),
comparator: (a, b) {
if (a == null || b == null) {
return false;
@@ -1194,8 +1194,6 @@ class _MessageListViewState extends State<MessageListView> {
_scrollController = widget.scrollController ?? ItemScrollController();
_itemPositionListener =
widget.itemPositionListener ?? ItemPositionsListener.create();
_itemPositionStream =
_valueListenableToStreamAdapter(_itemPositionListener.itemPositions);
_getOnThreadTap();
super.initState();