Repository navigation
feat(tasks): let the quick add task dialog be minimized - #305
Merged
Merged
Conversation
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 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 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
ModalBarrierbuilt byModalRoute.buildModalBarrier(). Both hosts get a subclass that yields that barrier while minimized:MinimizableSheetRouteModalSheetRouteMinimizableDialogRouteDialogRouteDialogRouteis aPopupRoute, soopaqueis alreadyfalse— 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 notePreserving 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:
Stateobject is never recreated.Offstage, not a conditional child. UnmountingQuickActionButtonsBarwould destroyTagSelectDropdown's internal selection;Offstagekeeps it mounted and merely excluded from hit testing.Wiring
SheetMinimizeController(aChangeNotifier) is owned by the code that pushes the route, so it outlives content rebuilds.SheetMinimizeScope(anInheritedNotifier) 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:
scrollController.offset == 0.0; background buttontapCount == 0offset > 0.0;tapCount == 1same(stateBeforeMinimize); typed text still presentNew user-facing strings (
minimize/restore) are translated across all 22 locales.📋 Checklist for Reviewer
flutter analyzeclean on changed files.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.