Skip to content

Add subtasks from Starred dialog + shared AddTaskFlow#67

Merged
sohamM97 merged 3 commits into
mainfrom
feature/add-subtask-from-starred
Jun 3, 2026
Merged

Add subtasks from Starred dialog + shared AddTaskFlow#67
sohamM97 merged 3 commits into
mainfrom
feature/add-subtask-from-starred

Conversation

@sohamM97
Copy link
Copy Markdown
Owner

@sohamM97 sohamM97 commented Jun 3, 2026

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

  • Bottom-right "+" FAB (highlighted, dulled-accent) replaces the small header + icon for adding subtasks.
  • "Add multiple" (brain dump) now works from the dialog — previously only SingleTask results were handled, so tapping "add multiple" silently did nothing.
  • Unified tap: tapping any starred card (leaf or not) now opens the expanded dialog, so a childless task can gain subtasks inline. Long-press navigates to All Tasks. (Reverses the earlier "leaf navigates directly" behavior, which existed only because the dialog had nothing to offer an empty task.)
  • The "Added N tasks" snackbar is suppressed in the dialog (it would flash behind it; the in-place tree refresh is the confirmation).

DRY refactor — AddTaskFlow

The 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 via addSingle/addBatch callbacks 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: pure transferPin (was duplicated per screen)
  • database_helper.insertTasksBatch / provider.addTasksBatch: return new task IDs; addTasksBatch gains an explicit parentId so batches parent correctly when invoked from another tab.

Testing

  • +21 automated tests (pure transferPin, insertTasksBatch/addTasksBatch, Starred FAB + brain-dump widget tests). Full suite passes (1340).
  • flutter analyze clean.
  • Manual sweep on Linux: Starred single-add, add-multiple, unified tap/long-press, and All Tasks add-flow regression all pass. (Pin-transfer manual testing deferred — see below.)

Docs

  • docs/UI_VIEWS.md, docs/TEST_COVERAGE.md updated.
  • CLAUDE.md: new "reuse existing dialogs/flows" DRY rule.
  • manual-test / test-suite skills hardened (timing is user's choice; never skip a broken test).

Follow-up (not in this PR)

  • Pinned-parent pin-transfer behavior is slated for redesign (logged in TODO) — the current auto-transfer is preserved here unchanged; manual pin testing was deferred pending that redesign.

🤖 Generated with Claude Code

Soham Marik and others added 2 commits May 28, 2026 18:21
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>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@claude
Copy link
Copy Markdown

claude Bot commented Jun 3, 2026

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

// The expanded dialog covers the page's snackbar, and its tree refreshes
// in place — so the "Added N tasks" snackbar would just flash behind it.
announceBatchAdd: false,
).run(context);

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>
@sohamM97 sohamM97 merged commit 2409add into main Jun 3, 2026
2 checks passed
@sohamM97 sohamM97 deleted the feature/add-subtask-from-starred branch June 3, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant