created callback model for task
This commit is contained in:
@@ -0,0 +1,57 @@
|
|||||||
|
import '../location.dart';
|
||||||
|
import '../task.dart';
|
||||||
|
|
||||||
|
class CreateTaskRequest {
|
||||||
|
final String title;
|
||||||
|
final String description;
|
||||||
|
final DateTime? start;
|
||||||
|
final DateTime? due;
|
||||||
|
final bool isCompleted;
|
||||||
|
final String category;
|
||||||
|
final List<Task> subtasks;
|
||||||
|
final List<DateTime> alarms;
|
||||||
|
final Location? location;
|
||||||
|
final String url;
|
||||||
|
|
||||||
|
CreateTaskRequest({
|
||||||
|
required this.title,
|
||||||
|
required this.description,
|
||||||
|
required this.start,
|
||||||
|
required this.due,
|
||||||
|
required this.isCompleted,
|
||||||
|
required this.category,
|
||||||
|
required this.subtasks,
|
||||||
|
required this.alarms,
|
||||||
|
required this.location,
|
||||||
|
required this.url,
|
||||||
|
});
|
||||||
|
|
||||||
|
CreateTaskRequest.fromTask(Task task)
|
||||||
|
: title = task.title,
|
||||||
|
description = task.description,
|
||||||
|
start = task.start,
|
||||||
|
due = task.due,
|
||||||
|
isCompleted = task.isCompleted,
|
||||||
|
category = task.category,
|
||||||
|
subtasks = task.subtasks,
|
||||||
|
alarms = task.alarms,
|
||||||
|
location = task.location,
|
||||||
|
url = task.url;
|
||||||
|
|
||||||
|
Task toTask({required String id, required int position}) {
|
||||||
|
return Task(
|
||||||
|
id: id,
|
||||||
|
title: title,
|
||||||
|
description: description,
|
||||||
|
start: start,
|
||||||
|
due: due,
|
||||||
|
isCompleted: isCompleted,
|
||||||
|
category: category,
|
||||||
|
subtasks: subtasks,
|
||||||
|
alarms: alarms,
|
||||||
|
location: location,
|
||||||
|
url: url,
|
||||||
|
position: position,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user