Merge pull request #696 from GetStream/hotfix/messageListView

fix(ui): fix MessageListView header and footer while reverse: false
This commit is contained in:
Salvatore Giordano
2021-09-22 15:16:18 +02:00
committed by GitHub
2 changed files with 21 additions and 6 deletions
@@ -6,6 +6,7 @@
there are no actions available to show.
- [[#349]](https://github.com/GetStream/stream-chat-flutter/issues/349): Fix `MessageInput` attachment render overflow error.
- [[#674]](https://github.com/GetStream/stream-chat-flutter/issues/674): Check scrollController is attached before calling jump in MessageListView.
- Fixed `MessageListView` header and footer when `reverse: false`.
🔄 Changed
@@ -494,14 +494,18 @@ class _MessageListViewState extends State<MessageListView> {
return _buildThreadSeparator();
}
if (i == itemCount - 3) {
if (widget.headerBuilder == null) {
if (widget.reverse
? widget.headerBuilder == null
: widget.footerBuilder == null) {
if (_isThreadConversation) return const Offstage();
return const SizedBox(height: 52);
}
return const SizedBox(height: 8);
}
if (i == 0) {
if (widget.footerBuilder == null) {
if (widget.reverse
? widget.footerBuilder == null
: widget.headerBuilder == null) {
return const SizedBox(height: 30);
}
return const SizedBox(height: 8);
@@ -560,8 +564,13 @@ class _MessageListViewState extends State<MessageListView> {
}
if (i == itemCount - 2) {
return widget.headerBuilder?.call(context) ??
const Offstage();
if (widget.reverse) {
return widget.headerBuilder?.call(context) ??
const Offstage();
} else {
return widget.footerBuilder?.call(context) ??
const Offstage();
}
}
if (i == itemCount - 3) {
@@ -579,8 +588,13 @@ class _MessageListViewState extends State<MessageListView> {
}
if (i == 0) {
return widget.footerBuilder?.call(context) ??
const Offstage();
if (widget.reverse) {
return widget.footerBuilder?.call(context) ??
const Offstage();
} else {
return widget.headerBuilder?.call(context) ??
const Offstage();
}
}
const bottomMessageIndex = 2; // 1 -> loader // 0 -> footer