Rename todo to scratch

This commit is contained in:
2025-04-22 00:20:27 +02:00
parent 442403b5b9
commit 963f7271a2
3 changed files with 33 additions and 28 deletions

View File

@@ -7,11 +7,11 @@ class Note {
Note({required this.date, required this.content});
}
class Todo {
class Scratch {
final String date;
final String content;
String content;
Todo({required this.date, required this.content});
Scratch({required this.date, required this.content});
}
Future<Note?> getLatestNote() async {
@@ -43,19 +43,21 @@ Future<void> updateNote(Note note) async {
);
}
Future<Todo?> getLatestTodo() async {
final todo = await DB.db.rawQuery(
'SELECT content, date FROM todos ORDER BY date DESC LIMIT 1',
Future<Scratch?> getLatestScratch() async {
final scratch = await DB.db.rawQuery(
'SELECT content, date FROM scratches ORDER BY date DESC LIMIT 1',
);
if (todo.isEmpty) {
if (scratch.isEmpty) {
return null;
} else {
return Scratch(
date: scratch[0]['date'] as String,
content: scratch[0]['content'] as String,
);
}
return Todo(
date: todo[0]['date'] as String,
content: todo[0]['content'] as String,
);
}
Future<void> createTodo(String content) async {
await DB.db.insert('todos', {'content': content});
Future<void> createScratch(String content) async {
await DB.db.insert('scratches', {'content': content});
}