added position field and copyWith constructor

This commit is contained in:
2026-06-09 11:22:57 +02:00
parent 2d927b8aed
commit 38dc91fd5a
+32
View File
@@ -12,6 +12,7 @@ class Task {
final List<DateTime> alarms; final List<DateTime> alarms;
final Location? location; final Location? location;
final String url; final String url;
final int position;
Task({ Task({
required this.id, required this.id,
@@ -25,5 +26,36 @@ class Task {
this.alarms = const [], this.alarms = const [],
this.location, this.location,
this.url = '', this.url = '',
required this.position,
}); });
Task copyWith({
String? id,
String? title,
String? description,
DateTime? start,
DateTime? due,
bool? isCompleted,
String? category,
List<Task>? subtasks,
List<DateTime>? alarms,
Location? location,
String? url,
int? position,
}) {
return Task(
id: id ?? this.id,
title: title ?? this.title,
description: description ?? this.description,
start: start ?? this.start,
due: due ?? this.due,
isCompleted: isCompleted ?? this.isCompleted,
category: category ?? this.category,
subtasks: subtasks ?? this.subtasks,
alarms: alarms ?? this.alarms,
location: location ?? this.location,
url: url ?? this.url,
position: position ?? this.position,
);
}
} }