diff --git a/lib/ui/widgets/posts_list_widget.dart b/lib/ui/widgets/posts_list_widget.dart index 8d7a86f..e06e129 100644 --- a/lib/ui/widgets/posts_list_widget.dart +++ b/lib/ui/widgets/posts_list_widget.dart @@ -52,6 +52,7 @@ class _PostsListWidgetState extends State { GroupsList _groups; ScrollWatcher _scrollController; ErrorLevel _error = ErrorLevel.NONE; + bool _loading = false; set error(ErrorLevel err) => setState(() => _error = err); @@ -68,11 +69,19 @@ class _PostsListWidgetState extends State { _loadPostsList(); } - void _loadError() => - error = _list == null ? ErrorLevel.MAJOR : ErrorLevel.MINOR; + void _loadError() { + error = _list == null ? ErrorLevel.MAJOR : ErrorLevel.MINOR; + _loading = false; + } /// Load the list of posts Future _loadPostsList({bool getOlder = false}) async { + + if(_loading) + return; + + _loading = true; + final list = !getOlder ? await widget.getPostsList() : await widget.getOlder(_list.oldestID); @@ -98,6 +107,8 @@ class _PostsListWidgetState extends State { _groups.addAll(groups); } }); + + _loading = false; } Widget _buildErrorCard() {