You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.9KB

  1. class Task {
  2. int? id;
  3. String? title;
  4. String? description;
  5. String? dueDate;
  6. String? executeDate;
  7. Assigned? assigned;
  8. bool? isCompleted;
  9. String? completedDetail;
  10. Task({
  11. this.id,
  12. this.title,
  13. this.description,
  14. this.dueDate,
  15. this.executeDate,
  16. this.assigned,
  17. this.isCompleted,
  18. this.completedDetail,
  19. });
  20. Task.fromJson(Map<String, dynamic> json) {
  21. title = json['title'];
  22. id = json['id'];
  23. description = json['detail'];
  24. dueDate = json['deadline'];
  25. executeDate = json['completedAt'];
  26. assigned = json['assigned'] != null ? new Assigned.fromJson(json['assigned']) : null;
  27. isCompleted = json['completed'];
  28. completedDetail = json['completedDetail'];
  29. }
  30. Map<String, dynamic> toJson() {
  31. final Map<String, dynamic> data = new Map<String, dynamic>();
  32. data['id'] = this.id;
  33. data['title'] = this.title;
  34. data['detail'] = this.description;
  35. data['deadline'] = this.dueDate;
  36. data['completedAt'] = this.executeDate;
  37. if (this.assigned != null) {
  38. data['assigned'] = this.assigned?.toJson();
  39. }
  40. data['completed'] = this.isCompleted;
  41. data['completedDetail'] = this.completedDetail;
  42. return data;
  43. }
  44. Task.clone(Task task) {
  45. this.id = task.id;
  46. this.title = task.title;
  47. this.description = task.description;
  48. this.dueDate = task.dueDate;
  49. this.executeDate = task.executeDate;
  50. this.assigned = task.assigned;
  51. this.isCompleted = task.isCompleted;
  52. this.completedDetail = task.completedDetail;
  53. }
  54. }
  55. class Assigned {
  56. int? id;
  57. bool? activated;
  58. Assigned({this.id, this.activated});
  59. Assigned.fromJson(Map<String, dynamic> json) {
  60. id = json['id'];
  61. activated = json['activated'];
  62. }
  63. Map<String, dynamic> toJson() {
  64. final Map<String, dynamic> data = new Map<String, dynamic>();
  65. data['id'] = this.id;
  66. data['activated'] = this.activated;
  67. return data;
  68. }
  69. }