1
0
mirror of https://github.com/go-vikunja/app synced 2024-09-16 12:51:46 +00:00

feat: added "add project" button

This commit is contained in:
Benimautner 2024-06-13 23:27:28 +02:00
parent c39aadabe0
commit fa48c80bb7
2 changed files with 11 additions and 4 deletions

@ -12,8 +12,10 @@ class ProjectAPIService extends APIService implements ProjectService {
@override
Future<Project?> create(Project p) {
// TODO: implement create
throw UnimplementedError();
return client.put('/projects', body: p.toJSON()).then((response) {
if (response == null) return null;
return Project.fromJson(response.body);
});
}
@override

@ -121,6 +121,12 @@ class _ProjectOverviewPageState extends State<ProjectOverviewPage>
),
appBar: AppBar(
title: Text("Projects"),
actions: [
IconButton(
icon: Icon(Icons.add),
onPressed: () => _addProjectDialog(context),
)
],
),
);
}
@ -158,7 +164,6 @@ class _ProjectOverviewPageState extends State<ProjectOverviewPage>
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('The project was created successfully!'),
));
}).catchError((error) => showDialog(
context: context, builder: (context) => ErrorDialog(error: error)));
});
}
}