feat:更新待办事项对话框功能
This commit is contained in:
@@ -1,45 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TodoItem {
|
||||
String id;
|
||||
num id;
|
||||
String title;
|
||||
String? description;
|
||||
String content;
|
||||
bool isCompleted;
|
||||
DateTime createdAt;
|
||||
DateTime? dueDate;
|
||||
TodoPriority priority;
|
||||
String? category;
|
||||
|
||||
TodoItem({
|
||||
required this.id,
|
||||
required this.title,
|
||||
this.description,
|
||||
required this.content,
|
||||
this.isCompleted = false,
|
||||
DateTime? createdAt,
|
||||
this.dueDate,
|
||||
this.priority = TodoPriority.medium,
|
||||
this.category,
|
||||
}) : createdAt = createdAt ?? DateTime.now();
|
||||
});
|
||||
|
||||
TodoItem copyWith({
|
||||
String? id,
|
||||
num? id,
|
||||
String? title,
|
||||
String? description,
|
||||
String? content,
|
||||
bool? isCompleted,
|
||||
DateTime? createdAt,
|
||||
DateTime? dueDate,
|
||||
TodoPriority? priority,
|
||||
String? category,
|
||||
}) {
|
||||
return TodoItem(
|
||||
id: id ?? this.id,
|
||||
title: title ?? this.title,
|
||||
description: description ?? this.description,
|
||||
content: content ?? this.content,
|
||||
isCompleted: isCompleted ?? this.isCompleted,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
dueDate: dueDate ?? this.dueDate,
|
||||
priority: priority ?? this.priority,
|
||||
category: category ?? this.category,
|
||||
);
|
||||
}
|
||||
|
||||
static TodoItem getEmpty() {
|
||||
return TodoItem(
|
||||
id: 0,
|
||||
title: '',
|
||||
content: '',
|
||||
isCompleted: false,
|
||||
dueDate: null,
|
||||
priority: TodoPriority.medium,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user