3.8 KiB
3.8 KiB
Phase 7: Task Sorting - Context
Gathered: 2026-03-16 Status: Ready for planning
## Phase BoundaryAdd sort controls to task list screens so users can reorder tasks by name (alphabetical), frequency interval, or effort level. The sort preference persists across app restarts. Requirements: SORT-01, SORT-02, SORT-03.
## Implementation DecisionsSort control widget
- Dropdown button in the AppBar, right side (trailing actions position)
- When collapsed, shows the current sort name as text (e.g., "A-Z", "Intervall", "Aufwand")
- Expands to show the 3 sort options as a standard dropdown menu
Sort option labels
- Claude's discretion — pick German labels that fit the app's existing localization style (concise but clear)
Sort scope
- One global sort preference applies to all task list screens
- Same dropdown appears in both the home screen (CalendarDayList) and per-room (TaskListScreen) AppBars
Persistence
- Store the sort preference in SharedPreferences (simple key-value for a single enum)
- No database schema change needed
- Persists across app restarts per success criteria
Default sort
- Claude's discretion — pick the least disruptive default (likely alphabetical to match current CalendarDayList behavior)
Claude's Discretion
- Sort option label text (German, concise)
- Default sort order (recommend alphabetical for continuity)
- Whether TaskListScreen also gets the dropdown (recommend yes for consistency with global setting, since the success criteria says "task list screens" plural)
- Sort direction (always ascending — A-Z, daily→yearly, low→high — no toggle needed for MVP)
- Dropdown styling (Material 3 DropdownButton or PopupMenuButton variant)
- Sort icon or visual indicator in the dropdown
- How overdue section interacts with sorting (recommend: overdue section stays pinned at top regardless of sort, only day tasks are sorted)
No specific requirements — open to standard approaches that match existing app patterns.
<code_context>
Existing Code Insights
Reusable Assets
EffortLevelenum (low/medium/high) with.indexfor ordering — directly usable for effort sortIntervalTypeenum with.indexordered roughly by frequency (daily=0 through yearly=7) — usable for interval sortFrequencyInterval.presetslist ordered most-frequent to least — reference for sort orderTask.namefield — direct alphabetical sort targetCalendarDayListandTaskListScreen— the two list widgets that need sort integrationAppLocalizations+.arbfiles — existing German localization pipeline
Established Patterns
- Manual
StreamProvider.autoDisposefor drift types (riverpod_generator issue) — sort provider follows same pattern calendarDayProviderwatchesselectedDateProvider— can also watch a sort preference providertasksInRoomProviderfamily provider — can be extended with sort parameter or read global sort- Feature folder structure:
features/home/,features/tasks/— sort logic may live in a shared location or in each feature
Integration Points
HomeScreenAppBar — add dropdown to trailing actionsTaskListScreenAppBar — already has edit/delete actions; add dropdown alongsideCalendarDao.watchTasksForDate()— currently sorts alphabetically; needs sort-aware query or in-memory sortTasksDao.watchTasksInRoom()— currently sorts by nextDueDate; needs sort-aware query or in-memory sortSharedPreferences— not yet used in the app; needs package addition and provider setupapp_de.arb— add localization strings for sort labels
</code_context>
## Deferred IdeasNone — discussion stayed within phase scope
Phase: 07-task-sorting Context gathered: 2026-03-16