Refactor note handling to use epoch time and improve utility functions for settings management

This commit is contained in:
2025-05-24 00:05:44 +02:00
parent dfe1c2b34c
commit 3c1f31d29b
4 changed files with 182 additions and 84 deletions

View File

@@ -2,7 +2,7 @@ import 'package:intl/intl.dart';
class Note {
final String id;
final String date;
final int epochTime;
late final String displayDate;
String content;
String? snippet;
@@ -11,21 +11,22 @@ class Note {
Note({
required this.id,
required this.date,
required this.epochTime,
required this.content,
this.snippet,
this.isProblematic = false,
this.problemReason = '',
}) {
final dtUtc = DateFormat('yyyy-MM-dd HH:mm:ss').parse(date, true);
final dtUtc = DateTime.fromMillisecondsSinceEpoch(epochTime, isUtc: true);
final dtLocal = dtUtc.toLocal();
displayDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(dtLocal);
}
}
class Scratch {
final String date;
final int epochTime;
final String id;
String content;
Scratch({required this.date, required this.content});
Scratch({required this.id, required this.epochTime, required this.content});
}