feat:合并待办和提醒功能
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
// flutter packages pub run build_runner build
|
||||
part 'todo.g.dart';
|
||||
|
||||
@HiveType(typeId: 0)
|
||||
@@ -21,12 +22,15 @@ class Todo extends HiveObject {
|
||||
late DateTime? dueDate;
|
||||
|
||||
@HiveField(5)
|
||||
late int priorityIndex;
|
||||
late DateTime? scheduledTime;
|
||||
|
||||
@HiveField(6)
|
||||
late DateTime createTime;
|
||||
late int priorityIndex;
|
||||
|
||||
@HiveField(7)
|
||||
late DateTime createTime;
|
||||
|
||||
@HiveField(8)
|
||||
late DateTime updateTime;
|
||||
|
||||
TodoPriority get priority => TodoPriority.values[priorityIndex];
|
||||
@@ -39,6 +43,7 @@ class Todo extends HiveObject {
|
||||
this.content = '',
|
||||
this.isCompleted = false,
|
||||
this.dueDate,
|
||||
this.scheduledTime,
|
||||
TodoPriority priority = TodoPriority.medium,
|
||||
DateTime? createTime,
|
||||
DateTime? updateTime,
|
||||
@@ -55,6 +60,7 @@ class Todo extends HiveObject {
|
||||
String? content,
|
||||
bool? isCompleted,
|
||||
DateTime? dueDate,
|
||||
DateTime? scheduledTime,
|
||||
TodoPriority? priority,
|
||||
}) {
|
||||
return Todo(
|
||||
@@ -63,6 +69,7 @@ class Todo extends HiveObject {
|
||||
content: content ?? this.content,
|
||||
isCompleted: isCompleted ?? this.isCompleted,
|
||||
dueDate: dueDate ?? this.dueDate,
|
||||
scheduledTime: scheduledTime ?? this.scheduledTime,
|
||||
priority: priority ?? this.priority,
|
||||
createTime: createTime,
|
||||
updateTime: DateTime.now(),
|
||||
@@ -72,10 +79,11 @@ class Todo extends HiveObject {
|
||||
static Todo getEmpty() {
|
||||
return Todo(
|
||||
id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||
title: '日常待办',
|
||||
title: '',
|
||||
content: '',
|
||||
isCompleted: false,
|
||||
dueDate: null,
|
||||
scheduledTime: null,
|
||||
priority: TodoPriority.medium,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user