mirror of
https://github.com/go-vikunja/app
synced 2024-06-05 03:59:48 +00:00
Merge remote-tracking branch 'go-vikunja/main' into null-safety-migration
# Conflicts: # lib/models/list.dart
This commit is contained in:
commit
2a271287db
11
README.md
11
README.md
|
@ -1,8 +1,11 @@
|
|||
# Vikunja Cross-Plattform app
|
||||
# Vikunja Cross-Plattform App
|
||||
|
||||
Download from [Releases](https://github.com/go-vikunja/app/releases/latest)
|
||||
|
||||
Vikunja as Flutter cross platform app.
|
||||
## Disclaimer
|
||||
|
||||
## TODO
|
||||
- Save loaded tasks for a while to optimize data usage
|
||||
This app is in alpha pre-release. You must absolutely expect things to not work, and sometimes even break something in the backend. Using this app on important production backends is possible but discouraged. However, as we rely on your feedback about missing features and bugs, we do encourage you to try it out and give us feedback here on GitHub. We are not responsible for lost data and similar destruction.
|
||||
|
||||
If you have anything to contribute, please open a PR. It is encouraged to let us know before you start developing, so we can discuss possible overlap with features other people might already be working on. This avoids unnecessary waste of time for either party.
|
||||
|
||||
It will be a while until this app is released to the Google Play Store. Until then, please download from the [Releases](https://github.com/go-vikunja/app/releases/latest) page. If you want to try this app on an iPhone, I cannot provide support, as I do not have an iPhone to develop on. However, contributors have confirmed that it works™. If you do decide to try it out, please share with the community any bugs you experience.
|
||||
|
|
|
@ -13,6 +13,7 @@ class ListAPIService extends APIService implements ListService {
|
|||
|
||||
@override
|
||||
Future<TaskList> create(namespaceId, TaskList tl) {
|
||||
tl.namespaceId = namespaceId;
|
||||
return client
|
||||
.put('/namespaces/$namespaceId/lists', body: tl.toJSON())
|
||||
.then((response) => TaskList.fromJson(response.body));
|
||||
|
|
|
@ -4,21 +4,24 @@ import 'package:vikunja_app/models/user.dart';
|
|||
|
||||
class TaskList {
|
||||
final int id;
|
||||
int namespaceId;
|
||||
final String? title, description;
|
||||
final User? owner;
|
||||
final DateTime? created, updated;
|
||||
List<Task?> tasks;
|
||||
final bool isFavorite;
|
||||
|
||||
TaskList(
|
||||
{required this.id,
|
||||
required this.title,
|
||||
this.description,
|
||||
this.owner,
|
||||
this.created,
|
||||
this.updated,
|
||||
this.tasks = const <Task>[],
|
||||
this.isFavorite = false});
|
||||
TaskList({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.namespaceId,
|
||||
this.description,
|
||||
this.owner,
|
||||
this.created,
|
||||
this.updated,
|
||||
this.tasks = const <Task>[],
|
||||
this.isFavorite = false,
|
||||
});
|
||||
|
||||
TaskList.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
@ -28,6 +31,7 @@ class TaskList {
|
|||
updated = DateTime.parse(json['updated']),
|
||||
created = DateTime.parse(json['created']),
|
||||
isFavorite = json['is_favorite'],
|
||||
namespaceId = json['namespace_id'],
|
||||
tasks = (json['tasks'] == null ? [] : json['tasks'] as List<dynamic>)
|
||||
.map((taskJson) => Task.fromJson(taskJson))
|
||||
.toList();
|
||||
|
@ -40,6 +44,7 @@ class TaskList {
|
|||
"owner": this.owner?.toJSON(),
|
||||
"created": this.created?.toIso8601String(),
|
||||
"updated": this.updated?.toIso8601String(),
|
||||
"namespace_id": this.namespaceId
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,11 +59,7 @@ class _ListPageState extends State<ListPage> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
_list = TaskList(
|
||||
id: widget.taskList.id,
|
||||
title: widget.taskList.title,
|
||||
tasks: [],
|
||||
);
|
||||
_list = widget.taskList;
|
||||
_keyboardController.onChange.listen((visible) {
|
||||
if (!visible && mounted) FocusScope.of(context).unfocus();
|
||||
});
|
||||
|
|
|
@ -138,10 +138,9 @@ class _ListEditPageState extends State<ListEditPage> {
|
|||
setState(() => _loading = true);
|
||||
// FIXME: is there a way we can update the list without creating a new list object?
|
||||
// aka updating the existing list we got from context (setters?)
|
||||
TaskList updatedList =
|
||||
TaskList(id: widget.list.id, title: _title, description: _description);
|
||||
|
||||
VikunjaGlobal.of(context).listService.update(updatedList).then((_) {
|
||||
widget.list.title = _title;
|
||||
widget.list.description = _description;
|
||||
VikunjaGlobal.of(context).listService.update(widget.list).then((_) {
|
||||
setState(() => _loading = false);
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text('The list was updated successfully!'),
|
||||
|
|
Loading…
Reference in New Issue
Block a user