Add tick boxes to task rows
Tasks now carry a tick box rather than being read-only rows. Ticking strikes the title through and leaves the item in place, so a day still reads as a record of what was asked rather than only what is left. New in designs/Checkbox.dart: - TickBox the square box itself, animating between empty and filled - TickRow box + struck-through title + caller-supplied detail and trailing - addTaskAffordance the centred "Add new task" control beneath a day's list Applied to the home plan, the overdue queue and the goal task list. Each screen holds a set of optimistically ticked ids so the tick lands immediately and rolls back if the call fails; the set is reconciled whenever fresh data arrives. A tick completes the item outright, whatever its proof requirement. The proof flow is still reachable from the Complete button in the overdue queue, so tasks that need an artefact have a route that asks for one — but the tick itself no longer enforces it. Late completes stay visually distinct: the row keeps a Late pill and the warning accent, and the user is told the window had already closed. flutter analyze lib/ reports no errors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mfu2gQLSFN21YRBcU2NrTt
This commit is contained in:
@@ -6,6 +6,7 @@ import '../../about/external/data/pages/request/PageAndSort.dart';
|
||||
import '../../about/external/data/pages/request/Pageable.dart';
|
||||
import '../../about/external/data/pages/request/Sort.dart';
|
||||
import '../../about/external/data/pages/response/CommitmentPage.dart';
|
||||
import '../../about/external/initial/CompletionRequest.dart';
|
||||
import '../../about/external/initial/ReportCardRequest.dart';
|
||||
import '../../about/internal/application/CommitmentClass.dart';
|
||||
import '../../about/internal/application/Standing.dart';
|
||||
@@ -141,6 +142,30 @@ class ViewHome extends ParentViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
/// Ticking a row completes it. The window decides whether that lands as a
|
||||
/// clean complete or a late one — the client never claims which.
|
||||
void tick(Commitment item) async {
|
||||
if (!await hasNetwork(() => tick(item))) return;
|
||||
|
||||
final bool late = item.wouldBeLate;
|
||||
|
||||
try {
|
||||
await getDataManager().completeCommitmentEntry(CompletionRequest(
|
||||
commitmentId: item.id ?? "",
|
||||
proofType: item.proofType.name,
|
||||
));
|
||||
|
||||
connection.onTicked(item, late);
|
||||
|
||||
// Clearing an item moves the debt, so the standing has to be re-derived
|
||||
// rather than left showing the number from before the tick.
|
||||
loadPlan();
|
||||
} catch (e) {
|
||||
connection.onTickFailed(item);
|
||||
handleError(e, () => tick(item), () => dismissError(), "Retry");
|
||||
}
|
||||
}
|
||||
|
||||
/// The gate on creating anything new. Grounded blocks everything; Warned
|
||||
/// blocks electives only.
|
||||
void requestNewCommitment(Standing standing, CommitmentClass intended) async {
|
||||
|
||||
Reference in New Issue
Block a user