Merge pull request #715 from GetStream/hotfix/floatingDateStream
fix(ui): fix floating date stream subscription
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
🐞 Fixed
|
🐞 Fixed
|
||||||
|
|
||||||
-[[#687]](https://github.com/GetStream/stream-chat-flutter/issues/687): Fix Users losing their place in the conversation after replying in threads.
|
-[[#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
|
✅ Added
|
||||||
|
|
||||||
|
|||||||
@@ -293,7 +293,6 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
void Function(Message)? _onThreadTap;
|
void Function(Message)? _onThreadTap;
|
||||||
bool _showScrollToBottom = false;
|
bool _showScrollToBottom = false;
|
||||||
late final ItemPositionsListener _itemPositionListener;
|
late final ItemPositionsListener _itemPositionListener;
|
||||||
late final Stream<Iterable<ItemPosition>> _itemPositionStream;
|
|
||||||
int? _messageListLength;
|
int? _messageListLength;
|
||||||
StreamChannelState? streamChannel;
|
StreamChannelState? streamChannel;
|
||||||
late StreamChatThemeData _streamTheme;
|
late StreamChatThemeData _streamTheme;
|
||||||
@@ -665,7 +664,8 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: BetterStreamBuilder<Iterable<ItemPosition>>(
|
child: BetterStreamBuilder<Iterable<ItemPosition>>(
|
||||||
initialData: _itemPositionListener.itemPositions.value,
|
initialData: _itemPositionListener.itemPositions.value,
|
||||||
stream: _itemPositionStream,
|
stream: _valueListenableToStreamAdapter(
|
||||||
|
_itemPositionListener.itemPositions),
|
||||||
comparator: (a, b) {
|
comparator: (a, b) {
|
||||||
if (a == null || b == null) {
|
if (a == null || b == null) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1194,8 +1194,6 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
_scrollController = widget.scrollController ?? ItemScrollController();
|
_scrollController = widget.scrollController ?? ItemScrollController();
|
||||||
_itemPositionListener =
|
_itemPositionListener =
|
||||||
widget.itemPositionListener ?? ItemPositionsListener.create();
|
widget.itemPositionListener ?? ItemPositionsListener.create();
|
||||||
_itemPositionStream =
|
|
||||||
_valueListenableToStreamAdapter(_itemPositionListener.itemPositions);
|
|
||||||
|
|
||||||
_getOnThreadTap();
|
_getOnThreadTap();
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|||||||
Reference in New Issue
Block a user