From 38dc91fd5abe42a2e7cc10418919caa92071a0b5 Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 9 Jun 2026 11:22:57 +0200 Subject: [PATCH] added position field and copyWith constructor --- lib/model/task.dart | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/model/task.dart b/lib/model/task.dart index bb32c97..8c3d8ee 100644 --- a/lib/model/task.dart +++ b/lib/model/task.dart @@ -12,6 +12,7 @@ class Task { final List alarms; final Location? location; final String url; + final int position; Task({ required this.id, @@ -25,5 +26,36 @@ class Task { this.alarms = const [], this.location, this.url = '', + required this.position, }); + + Task copyWith({ + String? id, + String? title, + String? description, + DateTime? start, + DateTime? due, + bool? isCompleted, + String? category, + List? subtasks, + List? 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, + ); + } }