feat:增加主题色存储本地的功能

This commit is contained in:
2025-11-12 15:17:20 +08:00
parent 0291039666
commit 011a4d05df
11 changed files with 442 additions and 369 deletions

View File

@@ -46,7 +46,6 @@ class TodoPageState extends State<TodoPage> {
padding: EdgeInsets.all(10),
child: Column(
children: [
buildStatsCard(_todos),
buildTabs(
context: context,
currentTab: _currentTab,
@@ -67,6 +66,7 @@ class TodoPageState extends State<TodoPage> {
return _activeTodos.isEmpty
? buildEmptyState(context, _currentTab)
: buildTodoList(
context: context,
todos: _activeTodos,
onToggleTodo: (todo) {
setState(() {
@@ -76,6 +76,9 @@ class TodoPageState extends State<TodoPage> {
onEditTodo: (todo) {
_showDialog(true, todo);
},
onDelete: (todo) {
_deleteTodo(todo);
},
);
}
@@ -149,4 +152,19 @@ class TodoPageState extends State<TodoPage> {
showErrorDialog(context, isEditing ? '更新失败' : '添加失败');
}
}
void _deleteTodo(Todo todo) async {
await notifyService.cancelNotification(todo.id);
bool isSuccess = await todoService.deleteTodo(todo);
setState(() {
_todos = todoService.getAllTodos();
});
if (isSuccess) {
showSuccessDialog(context, '删除成功');
} else {
showErrorDialog(context, '删除失败');
}
}
}