parsing of todo, retaining state over multiple sessions.
This commit is contained in:
32
lib/types/tasks.dart
Normal file
32
lib/types/tasks.dart
Normal 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(" ")
|
||||
;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user