Re-implemented getting tasks with the new seperate endpoint #39
|
@ -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(
|
||||
|
|
Reference in New Issue