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 1 // parent message
; ;
return ColoredBox( final child = Stack(
color: MessageListViewTheme.of(context).backgroundColor!,
child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
ConnectionStatusBuilder( ConnectionStatusBuilder(
@@ -560,8 +558,7 @@ class _MessageListViewState extends State<MessageListView> {
const Offstage(); const Offstage();
} }
const bottomMessageIndex = const bottomMessageIndex = 2; // 1 -> loader // 0 -> footer
2; // 1 -> loader // 0 -> footer
final message = messages[i - 2]; final message = messages[i - 2];
Widget messageWidget; Widget messageWidget;
@@ -588,8 +585,18 @@ class _MessageListViewState extends State<MessageListView> {
if (widget.showFloatingDateDivider) if (widget.showFloatingDateDivider)
_buildFloatingDateDivider(itemCount), _buildFloatingDateDivider(itemCount),
], ],
),
); );
final backgroundColor = MessageListViewTheme.of(context).backgroundColor;
if (backgroundColor != null) {
return ColoredBox(
color: backgroundColor,
child: child,
);
}
return child;
} }
Widget _buildThreadSeparator() { Widget _buildThreadSeparator() {