-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask_model.dart
More file actions
79 lines (71 loc) · 2.09 KB
/
task_model.dart
File metadata and controls
79 lines (71 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import 'package:flutter/material.dart';
// ─── Priority Enum ───────────────────────────────────────────
enum Priority { low, medium, high, urgent }
extension PriorityExtension on Priority {
String get label {
switch (this) {
case Priority.low:
return 'Low';
case Priority.medium:
return 'Medium';
case Priority.high:
return 'High';
case Priority.urgent:
return 'Urgent';
}
}
Color get color {
switch (this) {
case Priority.low:
return const Color(0xFF4CAF50); // xanh lá
case Priority.medium:
return const Color(0xFF2196F3); // xanh dương
case Priority.high:
return const Color(0xFFFF9800); // cam
case Priority.urgent:
return const Color(0xFFF44336); // đỏ
}
}
IconData get icon {
switch (this) {
case Priority.low:
return Icons.flag_outlined;
case Priority.medium:
return Icons.flag;
case Priority.high:
return Icons.flag;
case Priority.urgent:
return Icons.flag;
}
}
}
// ─── Tag Model ───────────────────────────────────────────────
class TagModel {
final String id;
final String name;
final Color color;
const TagModel({required this.id, required this.name, required this.color});
}
// ─── Task Model ──────────────────────────────────────────────
class TaskModel {
final String id;
String title;
String description;
String category;
TimeOfDay startTime;
TimeOfDay endTime;
DateTime date;
Priority priority;
List<TagModel> tags;
TaskModel({
required this.id,
required this.title,
required this.description,
required this.category,
required this.startTime,
required this.endTime,
required this.date,
this.priority = Priority.medium,
this.tags = const [],
});
}