Fix scrolling to last element
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
kolaente 2020-01-15 23:29:31 +01:00
parent 53dfe7327b
commit 96dbddb10c
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 8 additions and 0 deletions

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(