Add subtasks from Starred dialog + shared AddTaskFlow#67
Conversation
Adds a "+" affordance to the Starred expanded dialog header so subtasks can be created without leaving the Starred view. Opens the standard AddTaskDialog, creates the new task as a direct child of the starred task (via the new atRoot flag on TaskProvider.addTask so the add isn't accidentally nested under the All Tasks tab's current parent), and refreshes the tree in place. If the starred task is pinned in Today's 5, the "This task is pinned" warning appears first and the Today's 5 pin transfers to the new subtask on confirm — mirrors the All Tasks add flow so the pin doesn't silently disappear when the parent becomes non-leaf. No automated tests yet; ran flutter analyze + the existing starred + provider suites (260 passing). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The Starred expanded dialog's "+" affordance is now a highlighted bottom-right FAB, and "add multiple" (brain dump) works from it — it previously did nothing because only SingleTask results were handled. Tapping any starred card (leaf or not) now opens the dialog so a childless task can gain subtasks inline; long-press navigates to All Tasks. To avoid duplicating the add flow across screens, the dialog → single/brain-dump → Today's 5 pin handling is now the shared AddTaskFlow, used by both All Tasks and the Starred dialog with per-screen config (parenting, toggles, snackbar). This also fixes the double pinned-parent warning that the old All Tasks brain-dump path had. - todays_five_pin_helper: pure transferPin (was duplicated per screen) - database_helper.insertTasksBatch / provider.addTasksBatch: return new IDs; addTasksBatch gains explicit parentId so batches parent correctly from other tabs - Starred dialog suppresses the "Added N" snackbar (it'd flash behind the dialog; the in-place tree refresh is the confirmation) - +21 tests; docs (UI_VIEWS, TEST_COVERAGE) and CLAUDE.md DRY-reuse rule - manual-test/test-suite skills: timing is user's choice, never skip a broken test Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17824bf60b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| final result = await DatabaseHelper().getTodaysFiveTaskAndPinIds(todayDateKey()); | ||
| if (!mounted) return; | ||
| setState(() { | ||
| _starredTaskPinnedInTodays5 = result.pinnedIds.contains(widget.task.id); |
There was a problem hiding this comment.
Transfer Today's 5 slots for unpinned parents
When the starred task is in Today's 5 but not pinned, this only records false, so _addSubtask passes parentIsPinned: false and AddTaskFlow never calls transferPin. In that scenario, adding a subtask from the Starred dialog leaves the now-non-leaf parent in Today's 5 until the Today screen does a generic refresh/backfill, which can replace it with an unrelated task instead of the subtask the user just created; track membership separately from pin status and transfer the slot without showing the pinned warning.
Useful? React with 👍 / 👎.
|
Code review: 1 issue found. docs/UI_VIEWS.md line 28 describes an 'Added N tasks' snackbar for the Starred dialog brain-dump, but starred_screen.dart sets announceBatchAdd: false which suppresses it. The code comments: 'The expanded dialog covers the page snackbar so the snackbar would just flash behind it.' The in-place tree refresh is the actual confirmation. CLAUDE.md rule: 'When changing UI, update docs/UI_VIEWS.md to keep the UI reference in sync.' Fix: replace 'with an Added N tasks snackbar' with '(no snackbar - in-place tree refresh is the confirmation)'. See task-roulette/lib/screens/starred_screen.dart Lines 962 to 965 in 17824bf |
Addresses claude-review on PR #67 — the doc still claimed an "Added N tasks" snackbar for the Starred dialog, but the dialog sets announceBatchAdd: false (the snackbar would flash behind it; the in-place tree refresh is the confirmation). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What
Adds the ability to create subtasks directly from the Starred expanded dialog, and extracts the add-task flow shared by All Tasks and Starred into a single reusable
AddTaskFlow.Starred dialog
+icon for adding subtasks.SingleTaskresults were handled, so tapping "add multiple" silently did nothing.DRY refactor —
AddTaskFlowThe dialog → single/brain-dump branch → Today's 5 pin handling (pin-on-add + pin-transfer-to-new-child) is now the shared
lib/widgets/add_task_flow.dart, used by both All Tasks and the Starred dialog with per-screen config (parenting, which toggles to show, snackbar, pin-heir pick). Task creation is delegated viaaddSingle/addBatchcallbacks so each screen controls parenting.This deleted three duplicated methods from
task_list_screen.dart(_brainDump,_transferPinToChild,_pinNewTaskInTodays5) and also fixes a pre-existing double pinned-parent warning on the All Tasks brain-dump path.Supporting changes:
todays_five_pin_helper.dart: puretransferPin(was duplicated per screen)database_helper.insertTasksBatch/provider.addTasksBatch: return new task IDs;addTasksBatchgains an explicitparentIdso batches parent correctly when invoked from another tab.Testing
transferPin,insertTasksBatch/addTasksBatch, Starred FAB + brain-dump widget tests). Full suite passes (1340).flutter analyzeclean.Docs
docs/UI_VIEWS.md,docs/TEST_COVERAGE.mdupdated.CLAUDE.md: new "reuse existing dialogs/flows" DRY rule.manual-test/test-suiteskills hardened (timing is user's choice; never skip a broken test).Follow-up (not in this PR)
🤖 Generated with Claude Code