From 7d1259ce189cda1dfc3dc7f5ee7b517a02d94a55 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 21 Jul 2021 12:21:25 +0200 Subject: [PATCH] add null check to channel list view --- .../lib/src/channel_list_view.dart | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/channel_list_view.dart b/packages/stream_chat_flutter/lib/src/channel_list_view.dart index 1cec9d5c..e3340ec7 100644 --- a/packages/stream_chat_flutter/lib/src/channel_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/channel_list_view.dart @@ -231,13 +231,21 @@ class _ChannelListViewState extends State { ); } - return ColoredBox( - color: ChannelListViewTheme.of(context).backgroundColor!, - child: LazyLoadScrollView( - onEndOfPage: () => _channelListController.paginateData!(), - child: child, - ), + child = LazyLoadScrollView( + onEndOfPage: () => _channelListController.paginateData!(), + child: child, ); + + final backgroundColor = ChannelListViewTheme.of(context).backgroundColor; + + if (backgroundColor != null) { + return ColoredBox( + color: backgroundColor, + child: child, + ); + } + + return child; } Widget _buildListView(BuildContext context, List channels) {