feat(todo): a task's sub-tasks held and dragged into another order in its sheet
As a project's rows are (D16): a long press on a sub-task in the task's sheet or pane lifts it, and dropped on the upper or lower half of another it goes there, still the task's sub-task (the developer's review, 10 Nov 2026). Whats-New: In a task's details, hold a sub-task to drag it into another order. Whats-New-De: In den Details einer Aufgabe hältst du eine Unteraufgabe gedrückt, um sie in eine andere Reihenfolge zu ziehen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
ca9ad6c69c
commit
607ac71233
1 changed files with 92 additions and 3 deletions
|
|
@ -27,6 +27,7 @@ import 'package:halkyon_todo_flutter/src/feature/task/model/task_views.dart';
|
|||
import 'package:halkyon_todo_flutter/src/feature/task/widget/date_picker.dart';
|
||||
import 'package:halkyon_todo_flutter/src/feature/task/widget/quick_add_sheet.dart';
|
||||
import 'package:halkyon_todo_flutter/src/feature/task/widget/repeat_picker.dart';
|
||||
import 'package:halkyon_todo_flutter/src/feature/task/widget/task_drag.dart';
|
||||
import 'package:halkyon_todo_flutter/src/feature/task/widget/task_pickers.dart';
|
||||
import 'package:halkyon_todo_flutter/src/feature/task/widget/task_texts.dart';
|
||||
import 'package:halkyon_todo_flutter/src/feature/task/widget/task_tile.dart';
|
||||
|
|
@ -782,6 +783,10 @@ class _TaskSheetState() extends State<_TaskSheet> {
|
|||
final today = Day.of(clock.now());
|
||||
final project = state.projectOf(content.projectId);
|
||||
final subTasks = subTasksOf(state.tasks, task.id);
|
||||
final shownSubTasks = [
|
||||
for (final sub in subTasks)
|
||||
if (!(content.hideDoneSubTasks && sub.content.completed)) sub,
|
||||
];
|
||||
final labels = {
|
||||
for (final label in state.labels) label.id: label.content!.name,
|
||||
};
|
||||
|
|
@ -1009,13 +1014,17 @@ class _TaskSheetState() extends State<_TaskSheet> {
|
|||
),
|
||||
),
|
||||
),
|
||||
for (final sub in subTasks)
|
||||
if (!(content.hideDoneSubTasks && sub.content.completed))
|
||||
for (final (index, sub) in shownSubTasks.indexed)
|
||||
_placedSubTask(
|
||||
task,
|
||||
shownSubTasks,
|
||||
index,
|
||||
TaskTile(
|
||||
task: sub,
|
||||
selectable: false,
|
||||
onOpen: (id) => _open(context, id),
|
||||
),
|
||||
),
|
||||
],
|
||||
TextButton.icon(
|
||||
icon: const Icon(LucideIcons.plus),
|
||||
|
|
@ -1036,6 +1045,39 @@ class _TaskSheetState() extends State<_TaskSheet> {
|
|||
);
|
||||
}
|
||||
|
||||
/// The [index]th of [task]'s [subTasks] shown, as [child], held to be
|
||||
/// dragged to another place among them and taking a drop above or below
|
||||
/// it, staying [task]'s sub-task (the developer's review, 10 Nov 2026).
|
||||
static Widget _placedSubTask(
|
||||
OpenTask task,
|
||||
List<OpenTask> subTasks,
|
||||
int index,
|
||||
Widget child,
|
||||
) {
|
||||
final sub = subTasks[index];
|
||||
final sectionId = sub.content.sectionId;
|
||||
return TaskDropTarget(
|
||||
key: ValueKey('drop-${sub.id}'),
|
||||
projectId: sub.content.projectId,
|
||||
excluded: sub.id,
|
||||
above: DropSpot(
|
||||
sectionId: sectionId,
|
||||
parentId: task.id,
|
||||
after: index > 0 ? subTasks[index - 1].content.position : null,
|
||||
before: sub.content.position,
|
||||
),
|
||||
below: DropSpot(
|
||||
sectionId: sectionId,
|
||||
parentId: task.id,
|
||||
after: sub.content.position,
|
||||
before: index + 1 < subTasks.length
|
||||
? subTasks[index + 1].content.position
|
||||
: null,
|
||||
),
|
||||
child: DraggableTask(task: sub, child: child),
|
||||
);
|
||||
}
|
||||
|
||||
/// Asks for the task's reminders and writes them, asking first to
|
||||
/// remind where nothing was to be reminded of before.
|
||||
Future<void> _pickReminders(BuildContext context, TaskContent content) async {
|
||||
|
|
|
|||
Loading…
Reference in a new issue