add null check to message list view

This commit is contained in:
Salvatore Giordano
2021-07-21 12:17:58 +02:00
parent c2f375c64c
commit 9776fc5dfd
@@ -386,9 +386,7 @@ class _MessageListViewState extends State<MessageListView> {
1 // parent message
;
return ColoredBox(
color: MessageListViewTheme.of(context).backgroundColor!,
child: Stack(
final child = Stack(
alignment: Alignment.center,
children: [
ConnectionStatusBuilder(
@@ -560,8 +558,7 @@ class _MessageListViewState extends State<MessageListView> {
const Offstage();
}
const bottomMessageIndex =
2; // 1 -> loader // 0 -> footer
const bottomMessageIndex = 2; // 1 -> loader // 0 -> footer
final message = messages[i - 2];
Widget messageWidget;
@@ -588,8 +585,18 @@ class _MessageListViewState extends State<MessageListView> {
if (widget.showFloatingDateDivider)
_buildFloatingDateDivider(itemCount),
],
),
);
final backgroundColor = MessageListViewTheme.of(context).backgroundColor;
if (backgroundColor != null) {
return ColoredBox(
color: backgroundColor,
child: child,
);
}
return child;
}
Widget _buildThreadSeparator() {