Files
HouseHoldKeaper/.planning/milestones/v1.1-phases/07-task-sorting/07-01-SUMMARY.md
Jean-Luc Makiola edce11dd78 chore: complete v1.1 milestone
Archive v1.1 Calendar & Polish milestone artifacts (roadmap,
requirements, phase directories) to milestones/. Evolve PROJECT.md
with validated requirements and new key decisions. Update
RETROSPECTIVE.md with v1.1 section and cross-milestone trends.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 23:32:04 +01:00

5.8 KiB

phase, plan, subsystem, tags, requires, provides, affects, tech-stack, key-files, key-decisions, patterns-established, requirements-completed, duration, completed
phase plan subsystem tags requires provides affects tech-stack key-files key-decisions patterns-established requirements-completed duration completed
07-task-sorting 01 ui
flutter
riverpod
shared_preferences
sorting
localization
phase provides
05-calendar-strip calendarDayProvider and CalendarDayState used by sort integration
phase provides
06-task-history task domain model and CalendarTaskRow context
TaskSortOption enum (alphabetical, interval, effort)
SortPreferenceNotifier with SharedPreferences persistence
sortPreferenceProvider (keepAlive Riverpod provider)
calendarDayProvider with in-memory sort of dayTasks
tasksInRoomProvider with in-memory sort via stream.map
German localization strings
sortAlphabetical, sortInterval, sortEffort, sortLabel
07-02-sort-ui
any phase using calendarDayProvider or tasksInRoomProvider
added patterns
SortPreferenceNotifier: sync default return, async _loadPersisted() — same pattern as ThemeNotifier
In-memory sort helper functions (_sortTasks, _sortTasksRaw) applied after DB stream emit
overdueTasks intentionally unsorted — only dayTasks sorted
created modified
lib/features/tasks/domain/task_sort_option.dart
lib/features/tasks/presentation/sort_preference_notifier.dart
lib/features/tasks/presentation/sort_preference_notifier.g.dart
test/features/tasks/presentation/sort_preference_notifier_test.dart
lib/features/home/presentation/calendar_providers.dart
lib/features/tasks/presentation/task_providers.dart
lib/l10n/app_de.arb
lib/l10n/app_localizations.dart
lib/l10n/app_localizations_de.dart
Default sort is alphabetical — continuity with existing A-Z SQL sort in CalendarDayList
overdueTasks are NOT sorted — they stay pinned at the top in existing order
Sort stored as string (enum.name) in SharedPreferences — not intEnum, so reordering enum is safe
SortPreferenceNotifier uses keepAlive: true — global preference should never be disposed
SortPreferenceNotifier pattern: sync default + async _loadPersisted() — matches ThemeNotifier
In-memory sort via stream.map in StreamProvider — DB SQL sort provides stable baseline, in-memory overrides
SORT-01
SORT-02
SORT-03
4min 2026-03-16

Phase 07 Plan 01: Task Sort Domain and Provider Summary

TaskSortOption enum + SharedPreferences-backed SortPreferenceNotifier wired into calendarDayProvider and tasksInRoomProvider with in-memory alphabetical/interval/effort sorting

Performance

  • Duration: 4 min
  • Started: 2026-03-16T21:29:32Z
  • Completed: 2026-03-16T21:33:37Z
  • Tasks: 2
  • Files modified: 9

Accomplishments

  • TaskSortOption enum (alphabetical, interval, effort) with SharedPreferences persistence via SortPreferenceNotifier
  • calendarDayProvider now watches sortPreferenceProvider and sorts dayTasks in-memory; overdueTasks intentionally unsorted
  • tasksInRoomProvider now watches sortPreferenceProvider and applies sort via stream.map
  • 7 new unit tests for SortPreferenceNotifier covering default, state update, persistence, and restart recovery
  • 4 German localization strings added (sortAlphabetical, sortInterval, sortEffort, sortLabel)

Task Commits

Each task was committed atomically:

  1. TDD RED: Failing sort preference tests - a9f2983 (test)
  2. Task 1: TaskSortOption enum, SortPreferenceNotifier, localization - 13c7d62 (feat)
  3. Task 2: Sort integration into calendarDayProvider and tasksInRoomProvider - 3697e4e (feat)

Files Created/Modified

  • lib/features/tasks/domain/task_sort_option.dart - TaskSortOption enum with alphabetical/interval/effort values
  • lib/features/tasks/presentation/sort_preference_notifier.dart - SortPreferenceNotifier with SharedPreferences persistence
  • lib/features/tasks/presentation/sort_preference_notifier.g.dart - Generated Riverpod provider code
  • lib/features/home/presentation/calendar_providers.dart - Added sortPreferenceProvider watch + _sortTasks helper
  • lib/features/tasks/presentation/task_providers.dart - Added sortPreferenceProvider watch + _sortTasksRaw helper + stream.map
  • lib/l10n/app_de.arb - Added sortAlphabetical, sortInterval, sortEffort, sortLabel strings
  • lib/l10n/app_localizations.dart - Regenerated with sort string getters
  • lib/l10n/app_localizations_de.dart - Regenerated with German sort string implementations
  • test/features/tasks/presentation/sort_preference_notifier_test.dart - 7 unit tests for sort preference

Decisions Made

  • Default sort is alphabetical for continuity with existing SQL A-Z sort in CalendarDayList
  • overdueTasks section is explicitly NOT sorted — stays pinned at top in existing order
  • Sort preference stored as enum.name string in SharedPreferences (not intEnum) so enum reordering is always safe
  • SortPreferenceNotifier uses keepAlive: true — global app preference must not be disposed

Deviations from Plan

None - plan executed exactly as written.

Issues Encountered

None.

User Setup Required

None - no external service configuration required.

Next Phase Readiness

  • sortPreferenceProvider is live and defaults to alphabetical
  • Both task list providers react to sort preference changes immediately
  • Ready for 07-02: sort UI (dropdown in AppBar) to write to sortPreferenceProvider

Phase: 07-task-sorting Completed: 2026-03-16

Self-Check: PASSED

  • FOUND: lib/features/tasks/domain/task_sort_option.dart
  • FOUND: lib/features/tasks/presentation/sort_preference_notifier.dart
  • FOUND: lib/features/tasks/presentation/sort_preference_notifier.g.dart
  • FOUND: test/features/tasks/presentation/sort_preference_notifier_test.dart
  • FOUND: .planning/phases/07-task-sorting/07-01-SUMMARY.md
  • Commits a9f2983, 13c7d62, 3697e4e all verified in git log