8000 feat(tasks): let the quick add task dialog be minimized by ahmet-cetinkaya · Pull Request #305 · ahmet-cetinkaya/whph · GitHub
[go: up one dir, main page]

Skip to content

feat(tasks): let the quick add task dialog be minimized - #305

Merged
ahmet-cetinkaya merged 4 commits into
mainfrom
feat/quick-add-task-minimize
Sep 6, 2026
Merged

ahmet-cetinkaya merged 4 commits into
mainfrom
feat/quick-add-task-minimize

Conversation

@ahmet-cetinkaya
Copy link
Copy Markdown
Owner

🚀 Context

Composing a task blocked the list behind it, so users could not glance at a related task to jog their memory while typing.

This is the first of two remaining items from the multi-topic feedback in #215. The other four topics in that issue (tag color picker, tag deletion, tag dropdown, create-and-open) are already resolved in the current codebase.

This PR adds a minimize action to the Quick Add Task dialog. Collapsing the dialog hands input back to the page underneath, so the task list can be scrolled and tapped while a draft task stays intact.

🔗 Related


⚙️ Implementation Details

Dropping the barrier, not the route

A modal route intercepts pointers through the ModalBarrier built by ModalRoute.buildModalBarrier(). Both hosts get a subclass that yields that barrier while minimized:

Host Route Base
Mobile bottom sheet MinimizableSheetRoute ModalSheetRoute
Desktop dialog MinimizableDialogRoute DialogRoute

DialogRoute is a PopupRoute, so opaque is already false — the route below stays mounted and painted. The barrier was the only thing blocking input, so removing it is sufficient; no second navigator or overlay is involved.

stateDiagram-v2
    [*] --> Expanded: show()
    Expanded --> Minimized: minimize()
    Minimized --> Expanded: restore()
    Expanded --> [*]: create / dismiss

    note righ
8000
t of Expanded
        ModalBarrier present
        background inert
    end note

    note right of Minimized
        barrier yields SizedBox.shrink()
        background scrollable + tappable
        route still on the stack
    end note
Loading

Preserving what the user typed

Important

Minimizing never calls Navigator.pop(). All dialog state — title, description, tags, priority, estimated time, dates, lock toggles — lives in _QuickAddTaskDialogState, which would be disposed with the route.

Two details carry that guarantee:

  • The route stays on the stack, so the State object is never recreated.
  • The action bar is wrapped in Offstage, not a conditional child. Unmounting QuickActionButtonsBar would destroy TagSelectDropdown's internal selection; Offstage keeps it mounted and merely excluded from hit testing.

Wiring

SheetMinimizeController (a ChangeNotifier) is owned by the code that pushes the route, so it outlives content rebuilds. SheetMinimizeScope (an InheritedNotifier) carries it to the dialog. Its absence is what hides the minimize affordance on a host that cannot collapse — no dead button is ever rendered.

The file was renamed minimizable_sheet_route.dart → minimizable_routes.dart, since it now holds both routes.

Tests

Beyond asserting state survival, the suite proves the feature's actual purpose — that the background becomes usable — for both hosts:

State Asserted
Expanded scrollController.offset == 0.0; background button tapCount == 0
Minimized offset > 0.0; tapCount == 1
Restored Barrier blocks again
Across the cycle same(stateBeforeMinimize); typed text still present

New user-facing strings (minimize / restore) are translated across all 22 locales.


📋 Checklist for Reviewer

  • Tests passed locally — full suite, 2420 tests green; flutter analyze clean on changed files.
  • Commit history is clean and descriptive.
  • Documentation updated (if applicable) — N/A, no user-facing docs cover this dialog.
  • Code quality standards met (e.g., linter passed).

Note

Verification limit — worth a manual pass. The desktop binary builds and runs, but I could not raise its window programmatically under Wayland, so this was never exercised by hand. Correctness rests on the widget tests above, which drive the real routes and measure the intended behavior directly. A single manual try on desktop before merge would close that gap.

Tip

29 files sounds large, but 22 are one-line locale additions. The reviewable surface is minimizable_routes.dart (new, 119 lines), quick_add_task_dialog.dart, and the three test files.

Composing a task blocked the list behind it, so users could not glance at
a related task to jog their memory while typing (#215).

Add a minimize action that collapses the dialog and drops its modal
barrier, handing input back to the page underneath. Both hosts get it:
MinimizableSheetRoute for the mobile bottom sheet and MinimizableDialogRoute
for the desktop dialog, each overriding buildModalBarrier() to yield while
minimized. DialogRoute is a PopupRoute, so the route below is already
non-opaque and stays mounted and painted; the barrier was the only thing
intercepting pointers.

The route is never popped, so _QuickAddTaskDialogState survives and every
entered value comes back on restore. The action bar is wrapped in Offstage
rather than a conditional child for the same reason: unmounting it would
discard TagSelectDropdown's selection.

SheetMinimizeScope carries the controller to the content, and its absence
is what hides the affordance where a host cannot collapse.

Tests cover both hosts: the background list only scrolls and only accepts
taps while minimized, and the dialog State object is identical across a
minimize/restore cycle.
@ahmet-cetinkaya ahmet-cetinkaya added the enhancement New feature or request label Sep 6, 2026
@ahmet-cetinkaya ahmet-cetinkaya self-assigned this Sep 6, 2026
Dispose the minimize controller: it was constructed in both branches of
show() and never disposed, tripping ChangeNotifier leak tracking. It is
now built once and released when the route completes.

Replace the hand-rolled controller with a ValueNotifier<bool> typedef and
an extension for the named operations - the class only reimplemented what
ValueNotifier already provides.

Resolve the sheet container's theme from the builder context instead of
capturing it when the route is pushed, so the sheet repaints with the app
when the theme changes while it is open.

Read isMinimized from the scope in _buildTitleInput rather than passing it
as a flag argument.

Correct the Offstage rationale. Mutation testing disproved the comment's
claim that widget-internal state depends on it: replacing Offstage with a
conditional child kept the tag selection intact, because every entered
value lives in the controller and the action bar only renders it. Offstage
is kept to avoid re-running TagSelectDropdown's query on each collapse.

Cover what the tests previously asserted for the title only: a selected
tag and a typed description now survive the cycle, and minimizing is shown
to release focus so the keyboard cannot cover the page it just uncovered.
The stub tag handler returns real tags - with an empty list the tag
assertion would have passed vacuously.
The AVD stores `hw.gpu.mode = swiftshader_indirect`, which Android Studio
still writes but emulator 37 no longer accepts. It rejects the value, falls
back to `auto`, and selects the host GPU. On a Wayland session without a
working host GL stack that renders nothing: the window opens black and the
device never reports sys.boot_completed, so the script times out and the
debug session fails.

Passing `-gpu swangle` overrides the stale AVD setting with the renderer
this emulator version actually supports.
@ahmet-cetinkaya
ahmet-cetinkaya marked this pull request as ready for review September 6, 2026 10:52
@ahmet-cetinkaya
ahmet-cetinkaya merged commit 8e83232 into main Sep 6, 2026
3 checks passed
@ahmet-cetinkaya
ahmet-cetinkaya deleted the feat/quick-add-task-minimize branch September 6, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0