Re-implemented getting tasks with the new seperate endpoint #39

Open
konrad wants to merge 34 commits from feature/task-list into master
1 changed files with 8 additions and 0 deletions
Showing only changes of commit 96dbddb10c - Show all commits

View File

@ -61,8 +61,16 @@ class _ListPageState extends State<ListPage> {
if (i.isOdd) return Divider();
final index = i ~/ 2;
// This handles the case if there are no more elements in the list left which can be provided by the api
if(VikunjaGlobal.of(context).taskService.maxPages == _currentPage && index == _tasks.length - 1) return null;
if (index >= _tasks.length && VikunjaGlobal.of(context).taskService.maxPages < _currentPage) {
_currentPage++;
// FIXME: This does not get loaded until some time after the next (_tasks.length + 1) entry should have been rendered
// This leads to errors because the render method tries to access an entry of _tasks with an index which does not exist
// The load function gets actually called after the return below. I assume this is because of the setState() invocation
// in _loadTasksForPage()?
_loadTasksForPage(_currentPage);
}
return TaskTile(