From f1b92c8dcd00a633e80f10dee7853a90aac3b267 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 15 Jun 2019 16:09:49 +0200 Subject: [PATCH] Display a notice when there is no post on a page. --- lib/ui/widgets/posts_list_widget.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ui/widgets/posts_list_widget.dart b/lib/ui/widgets/posts_list_widget.dart index a7b531c..01be463 100644 --- a/lib/ui/widgets/posts_list_widget.dart +++ b/lib/ui/widgets/posts_list_widget.dart @@ -86,6 +86,15 @@ class _PostsListWidgetState extends State { 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() { return ListView.builder( itemCount: _list.length, @@ -117,6 +126,7 @@ class _PostsListWidgetState extends State { Widget build(BuildContext context) { if (_error == ErrorLevel.MAJOR) return _buildErrorCard(); if (_list == null) return buildCenteredProgressBar(); + if (_list.length == 0) return _buildNoPostNotice(); return widget.buildListView ? _buildListView() : _buildColumn(); }