fix: scrollToBottom not respecting false value

This commit is contained in:
Gordon Hayes
2022-02-18 15:26:44 +01:00
parent b4182a0a11
commit cfb41dd629
2 changed files with 15 additions and 13 deletions
@@ -3,6 +3,7 @@
🐞 Fixed 🐞 Fixed
- [[#888]](https://github.com/GetStream/stream-chat-flutter/issues/888) Fix `unban` command not working in `MessageInput`. - [[#888]](https://github.com/GetStream/stream-chat-flutter/issues/888) Fix `unban` command not working in `MessageInput`.
- Fix `showScrollToBottom` in `MessageListView` not respecting false value.
## 3.4.0 ## 3.4.0
- Updated `stream_chat_flutter_core` dependency to [`3.4.0`](https://pub.dev/packages/stream_chat_flutter_core/changelog). - Updated `stream_chat_flutter_core` dependency to [`3.4.0`](https://pub.dev/packages/stream_chat_flutter_core/changelog).
@@ -712,20 +712,21 @@ class _MessageListViewState extends State<MessageListView> {
); );
}, },
), ),
BetterStreamBuilder<bool>( if (widget.showScrollToBottom)
stream: streamChannel!.channel.state!.isUpToDateStream, BetterStreamBuilder<bool>(
initialData: streamChannel!.channel.state!.isUpToDate, stream: streamChannel!.channel.state!.isUpToDateStream,
builder: (context, snapshot) => ValueListenableBuilder<bool>( initialData: streamChannel!.channel.state!.isUpToDate,
valueListenable: _showScrollToBottom, builder: (context, snapshot) => ValueListenableBuilder<bool>(
child: _buildScrollToBottom(), valueListenable: _showScrollToBottom,
builder: (context, value, child) { child: _buildScrollToBottom(),
if (!snapshot || value) { builder: (context, value, child) {
return child!; if (!snapshot || value) {
} return child!;
return const Offstage(); }
}, return const Offstage();
},
),
), ),
),
if (widget.showFloatingDateDivider) if (widget.showFloatingDateDivider)
_buildFloatingDateDivider(itemCount), _buildFloatingDateDivider(itemCount),
], ],