Reload items after adding it (#28)
the build failed Details

This commit is contained in:
konrad 2019-03-14 21:27:13 +00:00 committed by Gitea
parent 893e59b00e
commit cc25bba0c7
2 changed files with 11 additions and 6 deletions

View File

@ -6,11 +6,11 @@ import 'package:vikunja_app/components/AddDialog.dart';
import 'package:vikunja_app/global.dart';
import 'package:vikunja_app/models/list.dart';
import 'package:vikunja_app/models/namespace.dart';
import 'package:vikunja_app/models/task.dart';
import 'package:vikunja_app/pages/list_page.dart';
class NamespaceFragment extends StatefulWidget {
final Namespace namespace;
NamespaceFragment({this.namespace})
: super(key: Key(namespace.id.toString()));
@ -100,8 +100,11 @@ class _NamespaceFragmentState extends State<NamespaceFragment> {
_addList(String name) {
VikunjaGlobal.of(context)
.listService
.create(widget.namespace.id, TaskList(id: null, title: name, tasks: []))
.then((_) => setState(() {}));
.listService
.create(widget.namespace.id, TaskList(id: null, title: name, tasks: []))
.then((_) {
setState(() {});
_updateLists();
});
}
}

View File

@ -114,7 +114,9 @@ class _ListPageState extends State<ListPage> {
setState(() {
_list.tasks.add(task);
});
}).then((_) => _updateList()
.then((_) => setState(() => _loadingTasks.remove(newTask))));
}).then((_) {
_updateList();
setState(() => _loadingTasks.remove(newTask));
});
}
}