1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09:21 +00:00

Display a notice when there is no post on a page.

This commit is contained in:
Pierre HUBERT 2019-06-15 16:09:49 +02:00
parent e20011d42e
commit f1b92c8dcd

View File

@ -86,6 +86,15 @@ class _PostsListWidgetState extends State<PostsListWidget> {
return buildErrorCard(tr("Could not get the list of posts !")); return buildErrorCard(tr("Could not get the list of posts !"));
} }
Widget _buildNoPostNotice() {
return Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(tr("There is no post to display here yet.")),
),
);
}
Widget _buildListView() { Widget _buildListView() {
return ListView.builder( return ListView.builder(
itemCount: _list.length, itemCount: _list.length,
@ -117,6 +126,7 @@ class _PostsListWidgetState extends State<PostsListWidget> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (_error == ErrorLevel.MAJOR) return _buildErrorCard(); if (_error == ErrorLevel.MAJOR) return _buildErrorCard();
if (_list == null) return buildCenteredProgressBar(); if (_list == null) return buildCenteredProgressBar();
if (_list.length == 0) return _buildNoPostNotice();
return widget.buildListView ? _buildListView() : _buildColumn(); return widget.buildListView ? _buildListView() : _buildColumn();
} }