feat:更新代办事项存储功能

This commit is contained in:
2025-11-07 21:24:09 +08:00
parent 00e65bc5be
commit 27f0638c01
9 changed files with 80 additions and 92 deletions

View File

@@ -25,14 +25,6 @@ class _TodoFormState extends State<TodoForm> {
@override
void initState() {
super.initState();
// 如果是编辑模式,初始化数据
if (widget.isEditing && widget.initialTodo != null) {
WidgetsBinding.instance.addPostFrameCallback((_) {
final store = Provider.of<TodoProvider>(context, listen: false);
store.initForm(widget.initialTodo!);
});
}
}
@override
@@ -201,7 +193,8 @@ class _TodoFormState extends State<TodoForm> {
: null,
),
validator: (value) {
if (value != null && value.isBefore(DateTime.now())) {
if (value != null &&
value.isBefore(DateTime.now().subtract(Duration(days: 1)))) {
return '不能选择过去的日期';
}
return null;