fix(ui): fix MessageListView header and footer while reverse: false
This commit is contained in:
@@ -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
|
||||
@@ -1199,12 +1213,10 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
initialAlignment = _initialAlignment;
|
||||
|
||||
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
|
||||
if (_scrollController?.isAttached == true) {
|
||||
_scrollController?.jumpTo(
|
||||
index: initialIndex,
|
||||
alignment: initialAlignment,
|
||||
);
|
||||
}
|
||||
_scrollController?.jumpTo(
|
||||
index: initialIndex,
|
||||
alignment: initialAlignment,
|
||||
);
|
||||
});
|
||||
|
||||
_messageNewListener =
|
||||
|
||||
Reference in New Issue
Block a user