listless

A simple list app for Apple platforms
Log | Files | Refs | README | LICENSE

commit f1425934d86438534c62db902d319be1f39ed1c6
parent 1223f5a5baf3b80cf48328dd8a8b1eef30f70361
Author: Michael Camilleri <[email protected]>
Date:   Thu, 19 Mar 2026 14:13:54 +0900

Update accent colour after draw row appears

Since the draft row is not part of the actual collection of items in the
database, it did not cause the accent colours of the existing rows to
change when it appeared. This commit changes that.

Co-Authored-By: Claude 4.6 Opus <[email protected]>

Diffstat:
MListlessiOS/Extensions/TaskListView+PullGestures.swift | 4++++
MListlessiOS/Views/TaskListView.swift | 7+++++--
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ListlessiOS/Extensions/TaskListView+PullGestures.swift b/ListlessiOS/Extensions/TaskListView+PullGestures.swift @@ -70,6 +70,7 @@ private struct PullGesturesModifier: ViewModifier { @State private var isAtBottom = false @State private var clearPullStartedAtBottom = false + let isDraftOpen: Bool let hasCompletedTasks: Bool let pullCreateThreshold: CGFloat let flickThreshold: CGFloat @@ -111,6 +112,7 @@ private struct PullGesturesModifier: ViewModifier { } private func handlePullToCreateScrollPhaseChange(from oldPhase: ScrollPhase, to newPhase: ScrollPhase) { + guard !isDraftOpen else { return } let action = pullToCreate.handlePhaseChange( from: oldPhase, to: newPhase, @@ -169,6 +171,7 @@ extension View { pullToCreate: Binding<TaskListView.PullToCreateState>, pullUpOffset: Binding<CGFloat>, isDragging: Binding<Bool>, + isDraftOpen: Bool, hasCompletedTasks: Bool, pullCreateThreshold: CGFloat, flickThreshold: CGFloat, @@ -181,6 +184,7 @@ extension View { pullToCreate: pullToCreate, pullUpOffset: pullUpOffset, isDragging: isDragging, + isDraftOpen: isDraftOpen, hasCompletedTasks: hasCompletedTasks, pullCreateThreshold: pullCreateThreshold, flickThreshold: flickThreshold, diff --git a/ListlessiOS/Views/TaskListView.swift b/ListlessiOS/Views/TaskListView.swift @@ -409,13 +409,15 @@ struct TaskListView: View, TaskListViewProtocol { @ViewBuilder private var taskRows: some View { let _ = iState.fetchWorkaround + let draftOffset = isPrependDraftVisible ? 1 : 0 + let draftTotal = draftPlacement != nil ? 1 : 0 ForEach(Array(displayActiveTasks.enumerated()), id: \.element.id) { index, task in let taskID = task.id TaskRowView( task: task, taskID: taskID, - index: index, - totalTasks: displayActiveTasks.count, + index: index + draftOffset, + totalTasks: displayActiveTasks.count + draftTotal, isSelected: fState.selectedTaskID == taskID, isDragging: isDraggingStateBinding, isScrolling: iState.isScrolling, @@ -634,6 +636,7 @@ struct TaskListView: View, TaskListViewProtocol { pullToCreate: pullToCreateStateBinding, pullUpOffset: pullUpOffsetStateBinding, isDragging: isDraggingStateBinding, + isDraftOpen: draftPlacement != nil, hasCompletedTasks: !completedTasks.isEmpty, pullCreateThreshold: pullCreateThreshold, flickThreshold: flickThreshold,