This commit is contained in:
2025-11-20 11:04:58 +08:00
3 changed files with 7 additions and 3 deletions

View File

@@ -16,7 +16,8 @@ class FlispService {
} }
List<Flisp> getAllFlisps() { List<Flisp> getAllFlisps() {
return box.values.toList(); return box.values.toList()
..sort((a, b) => b.updateTime.compareTo(a.updateTime));
} }
List<Flisp> getAllFlispsByYear(int year) { List<Flisp> getAllFlispsByYear(int year) {
@@ -28,6 +29,7 @@ class FlispService {
Future<bool> updateFlisp(Flisp flisp) async { Future<bool> updateFlisp(Flisp flisp) async {
try { try {
flisp.updateTime = DateTime.now();
await flisp.save(); await flisp.save();
return true; return true;
} catch (e) { } catch (e) {

View File

@@ -16,7 +16,8 @@ class TodoService {
} }
List<Todo> getAllTodos() { List<Todo> getAllTodos() {
return box.values.toList(); return box.values.toList()
..sort((a, b) => b.updateTime.compareTo(a.updateTime));
} }
List<Todo> getAllTodosByYear(int year) { List<Todo> getAllTodosByYear(int year) {
@@ -28,6 +29,7 @@ class TodoService {
Future<bool> updateTodo(Todo todo) async { Future<bool> updateTodo(Todo todo) async {
try { try {
todo.updateTime = DateTime.now();
await todo.save(); await todo.save();
return true; return true;
} catch (e) { } catch (e) {

View File

@@ -243,7 +243,7 @@ Widget buildFlispTag(Flisp flisp) {
Widget buildFlispTime(Flisp flisp) { Widget buildFlispTime(Flisp flisp) {
return Text( return Text(
DateFormat('yyyy-MM-dd HH:mm:ss').format(flisp.createTime), DateFormat('yyyy-MM-dd HH:mm:ss').format(flisp.updateTime),
style: TextStyle(fontSize: 12, color: Colors.grey), style: TextStyle(fontSize: 12, color: Colors.grey),
); );
} }