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

@@ -11,6 +11,7 @@ import 'package:audioplayers/audioplayers.dart';
// TODO: Add an entry field for the duration ie. the interval of apperance
// TODO: Also the sound file, if possible...
// TODO: Cram the above into the database
// TODO: Implement some sort of scroll through notes
const Duration popupInterval = Duration(minutes: 20);
const String notificationSound = 'MeetTheSniper.mp3';
@@ -133,7 +134,7 @@ class MainPageState extends State<MainPage> with WindowListener {
TextEditingController();
final TextEditingController _currentEntryController = TextEditingController();
final FocusNode _currentEntryFocusNode = FocusNode();
final TextEditingController _todoController = TextEditingController();
final TextEditingController _scratchController = TextEditingController();
Note? previousNote;
@@ -159,7 +160,7 @@ class MainPageState extends State<MainPage> with WindowListener {
_previousEntryController.dispose();
_currentEntryController.dispose();
_currentEntryFocusNode.dispose();
_todoController.dispose();
_scratchController.dispose();
_audioPlayer.dispose();
super.dispose();
}
@@ -232,25 +233,27 @@ class MainPageState extends State<MainPage> with WindowListener {
previousNote = note;
_previousEntryController.text = note?.content ?? "";
final todo = await getLatestTodo();
_todoController.text = todo?.content ?? "";
final scratch = await getLatestScratch();
_scratchController.text = scratch?.content ?? "";
_currentEntryController.text = "";
debugPrint("Data loaded (placeholder).");
debugPrint("Data loaded.");
}
void _saveData() async {
String previousEntry = _previousEntryController.text;
String currentEntry = _currentEntryController.text;
String todoList = _todoController.text;
String scratchContent = _scratchController.text;
await createNote(currentEntry);
await createTodo(todoList);
previousNote!.content = previousEntry;
await updateNote(previousNote!);
await createScratch(scratchContent);
if (previousNote != null) {
previousNote!.content = previousEntry;
await updateNote(previousNote!);
}
debugPrint(
"Saving data (placeholder)... Current Entry: [${currentEntry.length} chars], Todo: [${todoList.length} chars]",
"Saving data... Current Entry: [${currentEntry.length} chars], Scratch: [${scratchContent.length} chars]",
);
}
@@ -319,7 +322,7 @@ class MainPageState extends State<MainPage> with WindowListener {
Expanded(
flex: 3,
child: TextField(
controller: _todoController,
controller: _scratchController,
maxLines: null,
expands: true,
style:
@@ -327,7 +330,7 @@ class MainPageState extends State<MainPage> with WindowListener {
context,
).textTheme.bodyMedium, // Apply theme text style
decoration: const InputDecoration(
labelText: 'Todo',
labelText: 'Scratch',
// border: OutlineInputBorder(), // Handled by theme
// contentPadding: EdgeInsets.all(8.0), // Handled by theme or default
),