docs(07-02): complete sort dropdown UI plan

- 07-02-SUMMARY.md: SortDropdown widget wired into HomeScreen and TaskListScreen AppBars
- STATE.md: updated metrics, decisions, session record
- ROADMAP.md: Phase 7 complete (2/2 plans done)
This commit is contained in:
2026-03-16 22:40:39 +01:00
parent a3e4d0224b
commit 772034cba1
3 changed files with 137 additions and 9 deletions

View File

@@ -23,7 +23,7 @@ See `milestones/v1.0-ROADMAP.md` for full phase details.
- [x] **Phase 5: Calendar Strip** - Replace the stacked daily plan home screen with a horizontal scrollable date-strip and day-task list (completed 2026-03-16) - [x] **Phase 5: Calendar Strip** - Replace the stacked daily plan home screen with a horizontal scrollable date-strip and day-task list (completed 2026-03-16)
- [x] **Phase 6: Task History** - Record every task completion with a timestamp and expose a per-task history view (completed 2026-03-16) - [x] **Phase 6: Task History** - Record every task completion with a timestamp and expose a per-task history view (completed 2026-03-16)
- [ ] **Phase 7: Task Sorting** - Add alphabetical, interval, and effort sort options to task lists - [x] **Phase 7: Task Sorting** - Add alphabetical, interval, and effort sort options to task lists (completed 2026-03-16)
## Phase Details ## Phase Details
@@ -63,7 +63,7 @@ Plans:
2. Selecting alphabetical sort orders tasks A-Z by name within the visible list 2. Selecting alphabetical sort orders tasks A-Z by name within the visible list
3. Selecting interval sort orders tasks from most-frequent (daily) to least-frequent (yearly/custom) intervals 3. Selecting interval sort orders tasks from most-frequent (daily) to least-frequent (yearly/custom) intervals
4. Selecting effort sort orders tasks from lowest effort to highest effort level 4. Selecting effort sort orders tasks from lowest effort to highest effort level
**Plans:** 1/2 plans executed **Plans:** 2/2 plans complete
Plans: Plans:
- [ ] 07-01-PLAN.md — Sort model, persistence notifier, localization, provider integration - [ ] 07-01-PLAN.md — Sort model, persistence notifier, localization, provider integration
- [ ] 07-02-PLAN.md — Sort dropdown widget, HomeScreen AppBar, TaskListScreen integration, tests - [ ] 07-02-PLAN.md — Sort dropdown widget, HomeScreen AppBar, TaskListScreen integration, tests
@@ -78,4 +78,4 @@ Plans:
| 4. Notifications | v1.0 | 3/3 | Complete | 2026-03-16 | | 4. Notifications | v1.0 | 3/3 | Complete | 2026-03-16 |
| 5. Calendar Strip | 2/2 | Complete | 2026-03-16 | - | | 5. Calendar Strip | 2/2 | Complete | 2026-03-16 | - |
| 6. Task History | 1/1 | Complete | 2026-03-16 | - | | 6. Task History | 1/1 | Complete | 2026-03-16 | - |
| 7. Task Sorting | 1/2 | In Progress| | - | | 7. Task Sorting | 2/2 | Complete | 2026-03-16 | - |

View File

@@ -3,14 +3,14 @@ gsd_state_version: 1.0
milestone: v1.0 milestone: v1.0
milestone_name: milestone milestone_name: milestone
status: completed status: completed
stopped_at: Completed 07-task-sorting/07-01-PLAN.md stopped_at: Completed 07-task-sorting/07-02-PLAN.md
last_updated: "2026-03-16T21:34:49.629Z" last_updated: "2026-03-16T21:40:24.558Z"
last_activity: 2026-03-16 — Completed Phase 6 Plan 01 (task completion history) last_activity: 2026-03-16 — Completed Phase 6 Plan 01 (task completion history)
progress: progress:
total_phases: 3 total_phases: 3
completed_phases: 2 completed_phases: 3
total_plans: 5 total_plans: 5
completed_plans: 4 completed_plans: 5
percent: 100 percent: 100
--- ---
@@ -46,6 +46,7 @@ Progress: [██████████] 100% (1/1 plans in Phase 6)
| Phase 05-calendar-strip P02 | 8 | 3 tasks | 9 files | | Phase 05-calendar-strip P02 | 8 | 3 tasks | 9 files |
| Phase 06-task-history P01 | 5 | 2 tasks | 9 files | | Phase 06-task-history P01 | 5 | 2 tasks | 9 files |
| Phase 07-task-sorting P01 | 4 | 2 tasks | 9 files | | Phase 07-task-sorting P01 | 4 | 2 tasks | 9 files |
| Phase 07-task-sorting P02 | 4 | 2 tasks | 5 files |
## Accumulated Context ## Accumulated Context
@@ -67,6 +68,8 @@ Progress: [██████████] 100% (1/1 plans in Phase 6)
- [Phase 07-task-sorting]: Default sort is alphabetical — continuity with existing A-Z SQL sort in CalendarDayList - [Phase 07-task-sorting]: Default sort is alphabetical — continuity with existing A-Z SQL sort in CalendarDayList
- [Phase 07-task-sorting]: overdueTasks are NOT sorted — pinned at top in existing order per design decision - [Phase 07-task-sorting]: overdueTasks are NOT sorted — pinned at top in existing order per design decision
- [Phase 07-task-sorting]: Sort preference stored as enum.name string in SharedPreferences (not intEnum) — enum reordering safe - [Phase 07-task-sorting]: Sort preference stored as enum.name string in SharedPreferences (not intEnum) — enum reordering safe
- [Phase 07-task-sorting]: Used PopupMenuButton for SortDropdown in AppBar — menu overlay vs inline expansion, Material 3 pattern
- [Phase 07-task-sorting]: HomeScreen uses nested Scaffold for AppBar — standard StatefulShellRoute.indexedStack per-tab AppBar pattern
### Pending Todos ### Pending Todos
@@ -78,7 +81,7 @@ None.
## Session Continuity ## Session Continuity
Last session: 2026-03-16T21:34:49.627Z Last session: 2026-03-16T21:40:24.556Z
Stopped at: Completed 07-task-sorting/07-01-PLAN.md Stopped at: Completed 07-task-sorting/07-02-PLAN.md
Resume file: None Resume file: None
Next action: Phase 7 (task sorting) or release Next action: Phase 7 (task sorting) or release

View File

@@ -0,0 +1,125 @@
---
phase: 07-task-sorting
plan: 02
subsystem: ui
tags: [flutter, riverpod, material3, popup-menu, sort-ui, localization]
# Dependency graph
requires:
- phase: 07-task-sorting
plan: 01
provides: sortPreferenceProvider, TaskSortOption enum, German sort l10n strings
provides:
- SortDropdown ConsumerWidget (PopupMenuButton<TaskSortOption> with check marks)
- HomeScreen with AppBar (title: Übersicht, actions: SortDropdown)
- TaskListScreen AppBar with SortDropdown before edit/delete buttons
affects: [home_screen_test.dart, app_shell_test.dart, any screen showing HomeScreen]
# Tech tracking
tech-stack:
added: []
patterns:
- "PopupMenuButton<TaskSortOption> with Opacity check mark — avoids layout shift vs conditional Icon"
- "Nested Scaffold inside AppShell tab body — standard pattern for per-tab AppBars in StatefulShellRoute"
key-files:
created:
- lib/features/tasks/presentation/sort_dropdown.dart
modified:
- lib/features/home/presentation/home_screen.dart
- lib/features/tasks/presentation/task_list_screen.dart
- test/features/home/presentation/home_screen_test.dart
- test/shell/app_shell_test.dart
key-decisions:
- "Used PopupMenuButton instead of DropdownButton for AppBar — menu overlay vs inline expansion, consistent with Material 3 AppBar action patterns"
- "Opacity(opacity: isSelected ? 1 : 0) for check mark — preserves item width alignment vs conditional show/hide"
- "HomeScreen Scaffold is nested inside AppShell Scaffold — standard StatefulShellRoute pattern for per-tab AppBars"
# Metrics
duration: 4min
completed: 2026-03-16
---
# Phase 07 Plan 02: Sort Dropdown UI Summary
**SortDropdown ConsumerWidget using PopupMenuButton wired into HomeScreen AppBar (title: Übersicht) and TaskListScreen AppBar before edit/delete actions**
## Performance
- **Duration:** 4 min
- **Started:** 2026-03-16T21:35:56Z
- **Completed:** 2026-03-16T21:39:24Z
- **Tasks:** 2
- **Files modified:** 5 (1 created, 4 modified)
## Accomplishments
- SortDropdown ConsumerWidget: PopupMenuButton<TaskSortOption> with sort icon, current label, and check mark on active option
- HomeScreen wrapped in Scaffold with AppBar titled "Übersicht" and SortDropdown in trailing actions
- TaskListScreen AppBar has SortDropdown before the existing edit/delete IconButtons
- 2 new tests in HomeScreen test suite: verifies PopupMenuButton and AppBar title presence
- Auto-fixed app_shell_test regression caused by "Übersicht" now appearing twice (AppBar + bottom nav)
## Task Commits
Each task was committed atomically:
1. **Task 1: SortDropdown widget and HomeScreen/TaskListScreen integration** - `e5eccb7` (feat)
2. **Task 2: Sort dropdown tests and AppShell test fix** - `a3e4d02` (feat)
## Files Created/Modified
- `lib/features/tasks/presentation/sort_dropdown.dart` - Reusable SortDropdown ConsumerWidget with PopupMenuButton<TaskSortOption>
- `lib/features/home/presentation/home_screen.dart` - Added Scaffold with AppBar (Übersicht title + SortDropdown)
- `lib/features/tasks/presentation/task_list_screen.dart` - Added SortDropdown before edit/delete in AppBar actions
- `test/features/home/presentation/home_screen_test.dart` - Added sortPreferenceProvider override + 2 new sort dropdown tests
- `test/shell/app_shell_test.dart` - Fixed findsOneWidget -> findsWidgets for 'Übersicht' (now in AppBar + bottom nav)
## Decisions Made
- Used PopupMenuButton instead of DropdownButton for AppBar actions — menu overlay is cleaner in AppBar context (Material 3)
- Opacity trick for check mark: `Opacity(opacity: isSelected ? 1 : 0)` preserves item width so labels align regardless of selection
- HomeScreen uses nested Scaffold for AppBar — standard pattern in StatefulShellRoute.indexedStack; AppShell provides bottom nav, HomeScreen provides AppBar
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] Fixed AppShell test regression from 'Übersicht' duplicate**
- **Found during:** Task 2 test run
- **Issue:** `app_shell_test.dart` expected `findsOneWidget` for 'Übersicht'. Adding the HomeScreen AppBar title caused the string to appear twice (AppBar + bottom nav label).
- **Fix:** Changed `findsOneWidget` to `findsWidgets` in `app_shell_test.dart` line 67. Applied same fix to new `home_screen_test.dart` AppBar title test.
- **Files modified:** `test/shell/app_shell_test.dart`, `test/features/home/presentation/home_screen_test.dart`
- **Commit:** `a3e4d02`
## Issues Encountered
None beyond the auto-fixed regression.
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
- Phase 07 (task sorting) is now complete: data layer (07-01) + UI layer (07-02)
- Sort dropdown is live in both HomeScreen and TaskListScreen AppBars
- Selecting a sort option reactively reorders task lists via sortPreferenceProvider
- Preference persists across app restarts via SharedPreferences
---
*Phase: 07-task-sorting*
*Completed: 2026-03-16*
## Self-Check: PASSED
- FOUND: lib/features/tasks/presentation/sort_dropdown.dart
- FOUND: lib/features/home/presentation/home_screen.dart (modified)
- FOUND: lib/features/tasks/presentation/task_list_screen.dart (modified)
- FOUND: test/features/home/presentation/home_screen_test.dart (modified)
- FOUND: test/shell/app_shell_test.dart (modified)
- Commits e5eccb7, a3e4d02 verified in git log
- All 115 tests pass, dart analyze clean