feat:更新排序规则
This commit is contained in:
@@ -16,7 +16,8 @@ class FlispService {
|
||||
}
|
||||
|
||||
List<Flisp> getAllFlisps() {
|
||||
return box.values.toList();
|
||||
return box.values.toList()
|
||||
..sort((a, b) => b.updateTime.compareTo(a.updateTime));
|
||||
}
|
||||
|
||||
List<Flisp> getAllFlispsByYear(int year) {
|
||||
@@ -28,6 +29,7 @@ class FlispService {
|
||||
|
||||
Future<bool> updateFlisp(Flisp flisp) async {
|
||||
try {
|
||||
flisp.updateTime = DateTime.now();
|
||||
await flisp.save();
|
||||
return true;
|
||||
} catch (e) {
|
||||
|
||||
@@ -16,7 +16,8 @@ class TodoService {
|
||||
}
|
||||
|
||||
List<Todo> getAllTodos() {
|
||||
return box.values.toList();
|
||||
return box.values.toList()
|
||||
..sort((a, b) => b.updateTime.compareTo(a.updateTime));
|
||||
}
|
||||
|
||||
List<Todo> getAllTodosByYear(int year) {
|
||||
@@ -28,6 +29,7 @@ class TodoService {
|
||||
|
||||
Future<bool> updateTodo(Todo todo) async {
|
||||
try {
|
||||
todo.updateTime = DateTime.now();
|
||||
await todo.save();
|
||||
return true;
|
||||
} catch (e) {
|
||||
|
||||
@@ -244,7 +244,7 @@ Widget buildFlispTag(Flisp flisp) {
|
||||
|
||||
Widget buildFlispTime(Flisp flisp) {
|
||||
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),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user