add null check to user list view

This commit is contained in:
Salvatore Giordano
2021-07-21 12:23:09 +02:00
parent 7d1259ce18
commit f4457cb618
@@ -160,9 +160,7 @@ class _UserListViewState extends State<UserListView>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final child = ColoredBox( final userListCore = UserListCore(
color: UserListViewTheme.of(context).backgroundColor!,
child: UserListCore(
errorBuilder: widget.errorBuilder ?? errorBuilder: widget.errorBuilder ??
(BuildContext context, Object err) => _buildError(err), (BuildContext context, Object err) => _buildError(err),
emptyBuilder: widget.emptyBuilder ?? (context) => _buildEmpty(), emptyBuilder: widget.emptyBuilder ?? (context) => _buildEmpty(),
@@ -189,9 +187,17 @@ class _UserListViewState extends State<UserListView>
presence: widget.presence, presence: widget.presence,
groupAlphabetically: widget.groupAlphabetically, groupAlphabetically: widget.groupAlphabetically,
userListController: _userListController, userListController: _userListController,
),
); );
final backgroundColor = UserListViewTheme.of(context).backgroundColor;
final child = backgroundColor != null
? ColoredBox(
color: backgroundColor,
child: userListCore,
)
: userListCore;
if (!widget.pullToRefresh) { if (!widget.pullToRefresh) {
return child; return child;
} else { } else {