add null check to message search list view
This commit is contained in:
@@ -144,61 +144,69 @@ class _MessageSearchListViewState extends State<MessageSearchListView> {
|
|||||||
widget.messageSearchListController ?? _defaultController;
|
widget.messageSearchListController ?? _defaultController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => ColoredBox(
|
Widget build(BuildContext context) {
|
||||||
color: MessageSearchListViewTheme.of(context).backgroundColor!,
|
final messageSearchListCore = MessageSearchListCore(
|
||||||
child: MessageSearchListCore(
|
filters: widget.filters,
|
||||||
filters: widget.filters,
|
sortOptions: widget.sortOptions,
|
||||||
sortOptions: widget.sortOptions,
|
messageQuery: widget.messageQuery,
|
||||||
messageQuery: widget.messageQuery,
|
paginationParams: widget.paginationParams,
|
||||||
paginationParams: widget.paginationParams,
|
messageFilters: widget.messageFilters,
|
||||||
messageFilters: widget.messageFilters,
|
messageSearchListController: _messageSearchListController,
|
||||||
messageSearchListController: _messageSearchListController,
|
emptyBuilder: widget.emptyBuilder ??
|
||||||
emptyBuilder: widget.emptyBuilder ??
|
(context) => LayoutBuilder(
|
||||||
(context) => LayoutBuilder(
|
builder: (context, viewportConstraints) =>
|
||||||
builder: (context, viewportConstraints) =>
|
SingleChildScrollView(
|
||||||
SingleChildScrollView(
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
child: ConstrainedBox(
|
||||||
child: ConstrainedBox(
|
constraints: BoxConstraints(
|
||||||
constraints: BoxConstraints(
|
minHeight: viewportConstraints.maxHeight,
|
||||||
minHeight: viewportConstraints.maxHeight,
|
),
|
||||||
),
|
child: const Center(
|
||||||
child: const Center(
|
child: Text('There are no messages currently'),
|
||||||
child: Text('There are no messages currently'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
errorBuilder: widget.errorBuilder ??
|
),
|
||||||
(BuildContext context, dynamic error) {
|
),
|
||||||
if (error is Error) {
|
errorBuilder: widget.errorBuilder ??
|
||||||
print(error.stackTrace);
|
(BuildContext context, dynamic error) {
|
||||||
}
|
if (error is Error) {
|
||||||
return InfoTile(
|
print(error.stackTrace);
|
||||||
showMessage: widget.showErrorTile,
|
}
|
||||||
tileAnchor: Alignment.topCenter,
|
return InfoTile(
|
||||||
childAnchor: Alignment.topCenter,
|
showMessage: widget.showErrorTile,
|
||||||
message: 'An error occurred.',
|
tileAnchor: Alignment.topCenter,
|
||||||
child: Container(),
|
childAnchor: Alignment.topCenter,
|
||||||
);
|
message: 'An error occurred.',
|
||||||
},
|
child: Container(),
|
||||||
loadingBuilder: widget.loadingBuilder ??
|
);
|
||||||
(context) => LayoutBuilder(
|
},
|
||||||
builder: (context, viewportConstraints) =>
|
loadingBuilder: widget.loadingBuilder ??
|
||||||
SingleChildScrollView(
|
(context) => LayoutBuilder(
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
builder: (context, viewportConstraints) =>
|
||||||
child: ConstrainedBox(
|
SingleChildScrollView(
|
||||||
constraints: BoxConstraints(
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
minHeight: viewportConstraints.maxHeight,
|
child: ConstrainedBox(
|
||||||
),
|
constraints: BoxConstraints(
|
||||||
child: const Center(
|
minHeight: viewportConstraints.maxHeight,
|
||||||
child: CircularProgressIndicator(),
|
),
|
||||||
),
|
child: const Center(
|
||||||
),
|
child: CircularProgressIndicator(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
childBuilder: widget.childBuilder ?? _buildListView,
|
),
|
||||||
),
|
),
|
||||||
);
|
childBuilder: widget.childBuilder ?? _buildListView,
|
||||||
|
);
|
||||||
|
|
||||||
|
final backgroundColor =
|
||||||
|
MessageSearchListViewTheme.of(context).backgroundColor;
|
||||||
|
return backgroundColor != null
|
||||||
|
? ColoredBox(
|
||||||
|
color: backgroundColor,
|
||||||
|
child: messageSearchListCore,
|
||||||
|
)
|
||||||
|
: messageSearchListCore;
|
||||||
|
}
|
||||||
|
|
||||||
Widget _separatorBuilder(BuildContext context, int index) => Container(
|
Widget _separatorBuilder(BuildContext context, int index) => Container(
|
||||||
height: 1,
|
height: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user