feat:合并待办和提醒功能

This commit is contained in:
2025-11-09 11:16:24 +08:00
parent d5ff4c9b02
commit 7c3d35eb18
16 changed files with 259 additions and 730 deletions

View File

@@ -1,4 +1,5 @@
import 'package:flisp_app/models/todo.dart';
import 'package:intl/intl.dart';
List<Todo> getActiveTodos(TodoTab currentTab, List<Todo> todos) {
switch (currentTab) {
@@ -20,4 +21,25 @@ List<Todo> getActiveTodos(TodoTab currentTab, List<Todo> todos) {
default:
return todos;
}
}
}
// 格式化截止日期
String formatDueDate(DateTime dueDate, bool isToday, bool isTomorrow) {
if (isToday) return '今天截止';
if (isTomorrow) return '明天截止';
final now = DateTime.now();
final difference = dueDate.difference(DateTime(now.year, now.month, now.day));
if (difference.inDays < 7) {
return '${difference.inDays}天后截止';
}
return DateFormat("MM-dd").format(dueDate);
}
bool isSameDay(DateTime date1, DateTime date2) {
return date1.year == date2.year &&
date1.month == date2.month &&
date1.day == date2.day;
}