Merge branch 'master' into improvement/show-empty-notice
the build failed
Details
the build failed
Details
# Conflicts: # lib/fragments/namespace.dart # lib/pages/list_page.dart
This commit is contained in:
commit
020ff3e2d2
|
@ -58,8 +58,10 @@ class _NamespaceFragmentState extends State<NamespaceFragment> {
|
|||
onRefresh: _loadLists,
|
||||
)
|
||||
: Center(child: CircularProgressIndicator()),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => _addListDialog(), child: const Icon(Icons.add)),
|
||||
floatingActionButton: Builder(
|
||||
builder: (context) => FloatingActionButton(
|
||||
onPressed: () => _addListDialog(context), child: const Icon(Icons.add))
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -93,23 +95,28 @@ class _NamespaceFragmentState extends State<NamespaceFragment> {
|
|||
MaterialPageRoute(builder: (context) => ListPage(taskList: list)));
|
||||
}
|
||||
|
||||
_addListDialog() {
|
||||
_addListDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AddDialog(
|
||||
onAdd: _addList,
|
||||
onAdd: (name) => _addList(name, context),
|
||||
decoration: new InputDecoration(
|
||||
labelText: 'List Name', hintText: 'eg. Shopping List')),
|
||||
);
|
||||
}
|
||||
|
||||
_addList(String name) {
|
||||
_addList(String name, BuildContext context) {
|
||||
VikunjaGlobal.of(context)
|
||||
.listService
|
||||
.create(widget.namespace.id, TaskList(id: null, title: name, tasks: []))
|
||||
.then((_) {
|
||||
setState(() {});
|
||||
_loadLists();
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('The list was successfully created!'),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,21 +36,26 @@ class HomePageState extends State<HomePage> {
|
|||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
_addNamespaceDialog() {
|
||||
_addNamespaceDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AddDialog(
|
||||
onAdd: _addNamespace,
|
||||
onAdd: (name) => _addNamespace(name, context),
|
||||
decoration: new InputDecoration(
|
||||
labelText: 'Namespace', hintText: 'eg. Personal Namespace'),
|
||||
));
|
||||
}
|
||||
|
||||
_addNamespace(String name) {
|
||||
_addNamespace(String name, BuildContext context) {
|
||||
VikunjaGlobal.of(context)
|
||||
.namespaceService
|
||||
.create(Namespace(id: null, name: name))
|
||||
.then((_) => _updateNamespaces());
|
||||
.then((_) {
|
||||
_updateNamespaces();
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text('The namespace was created successfully!'),
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _updateNamespaces() {
|
||||
|
@ -113,10 +118,12 @@ class HomePageState extends State<HomePage> {
|
|||
)),
|
||||
new Align(
|
||||
alignment: FractionalOffset.bottomCenter,
|
||||
child: new ListTile(
|
||||
leading: const Icon(Icons.add),
|
||||
title: const Text('Add namespace...'),
|
||||
onTap: () => _addNamespaceDialog(),
|
||||
child: Builder(
|
||||
builder: (context) => ListTile(
|
||||
leading: const Icon(Icons.add),
|
||||
title: const Text('Add namespace...'),
|
||||
onTap: () => _addNamespaceDialog(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
])),
|
||||
|
|
|
@ -105,19 +105,17 @@ class _ListEditPageState extends State<ListEditPage> {
|
|||
VikunjaGlobal.of(context).listService.update(updatedList)
|
||||
.then((_) {
|
||||
setState(() => _loading = false);
|
||||
final scaffold = Scaffold.of(context);
|
||||
scaffold.showSnackBar(SnackBar(
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text('The list was updated successfully!'),
|
||||
));
|
||||
})
|
||||
.catchError((err) {
|
||||
setState(() => _loading = false);
|
||||
final scaffold = Scaffold.of(context);
|
||||
scaffold.showSnackBar(
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Something went wrong: ' + err.toString()),
|
||||
action: SnackBarAction(
|
||||
label: 'CLOSE', onPressed: scaffold.hideCurrentSnackBar),
|
||||
label: 'CLOSE', onPressed: Scaffold.of(context).hideCurrentSnackBar),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
|
|
@ -63,9 +63,10 @@ class _ListPageState extends State<ListPage> {
|
|||
onRefresh: _loadList,
|
||||
)
|
||||
: Center(child: CircularProgressIndicator()),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => _addItemDialog(), child: Icon(Icons.add)),
|
||||
);
|
||||
floatingActionButton: Builder(
|
||||
builder: (context) => FloatingActionButton(
|
||||
onPressed: () => _addItemDialog(context), child: Icon(Icons.add)),
|
||||
));
|
||||
}
|
||||
|
||||
List<Widget> _listTasks() {
|
||||
|
@ -98,16 +99,16 @@ class _ListPageState extends State<ListPage> {
|
|||
});
|
||||
}
|
||||
|
||||
_addItemDialog() {
|
||||
_addItemDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AddDialog(
|
||||
onAdd: _addItem,
|
||||
onAdd: (name) => _addItem(name, context),
|
||||
decoration: new InputDecoration(
|
||||
labelText: 'Task Name', hintText: 'eg. Milk')));
|
||||
}
|
||||
|
||||
_addItem(String name) {
|
||||
_addItem(String name, BuildContext context) {
|
||||
var globalState = VikunjaGlobal.of(context);
|
||||
var newTask =
|
||||
Task(id: null, text: name, owner: globalState.currentUser, done: false);
|
||||
|
@ -119,6 +120,9 @@ class _ListPageState extends State<ListPage> {
|
|||
}).then((_) {
|
||||
_loadList();
|
||||
setState(() => _loadingTasks.remove(newTask));
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text('The task was added successfully!'),
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue