This commit is contained in:
kolaente 2020-01-13 22:47:40 +01:00
parent cf9c9b4cb4
commit 187337c580
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 9 additions and 9 deletions

View File

@ -29,7 +29,8 @@ class TaskAPIService extends APIService implements TaskService {
@override @override
Future<List<Task>> getAll(int listId) { Future<List<Task>> getAll(int listId) {
return client.get('/lists/$listId/tasks').then( return client
(list) => convertList(list, (result) => Task.fromJson(result))); .get('/lists/$listId/tasks')
.then((list) => convertList(list, (result) => Task.fromJson(result)));
} }
} }

View File

@ -31,7 +31,10 @@ class Task {
description = json['description'], description = json['description'],
text = json['text'], text = json['text'],
done = json['done'], done = json['done'],
owner = json['createdBy'].toString() == "null" ? null : User.fromJson(json['createdBy']); // There has to be a better way of doing this... owner = json['createdBy'].toString() == "null"
? null
: User.fromJson(json[
'createdBy']); // There has to be a better way of doing this...
toJSON() => { toJSON() => {
'id': id, 'id': id,

View File

@ -25,8 +25,7 @@ class _ListPageState extends State<ListPage> {
@override @override
void initState() { void initState() {
_list = TaskList( _list = TaskList(id: widget.taskList.id, title: widget.taskList.title);
id: widget.taskList.id, title: widget.taskList.title);
super.initState(); super.initState();
} }
@ -97,10 +96,7 @@ class _ListPageState extends State<ListPage> {
_loading = false; _loading = false;
_list = list; _list = list;
// Load tasks // Load tasks
VikunjaGlobal.of(context) VikunjaGlobal.of(context).taskService.getAll(list.id).then((tasks) {
.taskService
.getAll(list.id)
.then((tasks) {
setState(() { setState(() {
_tasks = tasks; _tasks = tasks;
}); });