parsing of todo, retaining state over multiple sessions.

This commit is contained in:
2023-01-09 17:27:04 +01:00
parent 60edaddc03
commit 61d444bd41
10 changed files with 295 additions and 12 deletions

32
lib/types/tasks.dart Normal file
View File

@ -0,0 +1,32 @@
class Task {
final bool done;
final DateTime? begin;
final DateTime? end;
final String title;
final List<String> contexts;
final List<String> projects;
final Map<String,String> meta;
final String? priority;
Task({
required this.title,
this.done = false,
this.contexts = const [],
this.projects = const [],
this.meta = const {},
this.priority,
this.begin,
this.end,
});
@override
String toString() {
return (done ? "x " : "")
+ (priority == null ? "" : "(${priority!}) ")
+ (begin == null ? "" : "${begin!.year}-${begin!.month}-${begin!.day} ")
+ (end == null ? "" : "${end!.year}-${end!.month}-${end!.day} ")
+ ("$title ")
+ meta.entries.map((entry) => "${entry.key}:${entry.value}").join(" ")
;
}
}