---
phase: 03-daily-plan-and-cleanliness
plan: 02
subsystem: ui
tags: [flutter, riverpod, widget, animation, localization, consumer-stateful]

# Dependency graph
requires:
  - phase: 03-daily-plan-and-cleanliness
    provides: DailyPlanDao, DailyPlanState, dailyPlanProvider, TaskWithRoom model, 10 localization keys
  - phase: 02-rooms-and-tasks
    provides: taskActionsProvider for task completion, GoRouter routes for room navigation
provides:
  - Complete daily plan HomeScreen replacing placeholder
  - DailyPlanTaskRow widget with room tag navigation and optional checkbox
  - ProgressCard widget with linear progress bar
  - Animated task completion (SizeTransition + SlideTransition)
  - Empty states for no-tasks and all-clear scenarios
  - 6 widget tests for HomeScreen states
affects: [03-03-phase-verification]

# Tech tracking
tech-stack:
  added: []
  patterns:
    - "ConsumerStatefulWidget with local animation state for task completion"
    - "Provider override pattern for widget tests without database"
    - "SizeTransition + SlideTransition combo for animated list item removal"

key-files:
  created:
    - lib/features/home/presentation/daily_plan_task_row.dart
    - lib/features/home/presentation/progress_card.dart
    - test/features/home/presentation/home_screen_test.dart
  modified:
    - lib/features/home/presentation/home_screen.dart
    - test/shell/app_shell_test.dart

key-decisions:
  - "Used simpler stream-driven approach with local _completingTaskIds for animation instead of AnimatedList"
  - "DailyPlanTaskRow is StatelessWidget (not ConsumerWidget) -- completion callback passed in from parent"
  - "No-tasks empty state uses dailyPlanNoTasks key (not homeEmptyTitle) for clearer messaging"

patterns-established:
  - "DailyPlan task row: room tag as tappable Container with secondaryContainer color, no row-tap navigation"
  - "Completing animation: track IDs in local Set, wrap in SizeTransition/SlideTransition, stream re-emission cleans up"

requirements-completed: [PLAN-04, PLAN-06, CLEAN-01]

# Metrics
duration: 4min
completed: 2026-03-16
---

# Phase 3 Plan 02: Daily Plan UI Summary

**Complete daily plan HomeScreen with progress card, overdue/today/tomorrow sections, animated checkbox completion, and celebration empty state**

## Performance

- **Duration:** 4 min
- **Started:** 2026-03-16T11:35:00Z
- **Completed:** 2026-03-16T11:39:17Z
- **Tasks:** 2
- **Files modified:** 5

## Accomplishments
- HomeScreen fully rewritten from placeholder to complete daily plan with progress card, three task sections, and animated completion
- DailyPlanTaskRow with tappable room name tag (navigates to room), relative date (coral if overdue), optional checkbox, no row-tap
- ProgressCard showing "X von Y erledigt" with LinearProgressIndicator
- Animated task completion: checkbox tap triggers SizeTransition + SlideTransition animation while stream re-emission permanently removes the task
- Three empty states: no-tasks (first-run), all-clear (celebration), all-clear-with-tomorrow
- 6 widget tests covering all states; 72/72 tests passing with no regressions

## Task Commits

Each task was committed atomically:

1. **Task 1: DailyPlanTaskRow and ProgressCard widgets** - `4e3a3ed` (feat)
2. **Task 2: HomeScreen rewrite with daily plan sections, animated completion, empty state, and tests** - `444213e` (feat)

## Files Created/Modified
- `lib/features/home/presentation/daily_plan_task_row.dart` - Task row for daily plan with room tag, relative date, optional checkbox
- `lib/features/home/presentation/progress_card.dart` - Progress banner card with linear progress bar
- `lib/features/home/presentation/home_screen.dart` - Complete rewrite: ConsumerStatefulWidget with daily plan UI
- `test/features/home/presentation/home_screen_test.dart` - 6 widget tests for empty, all-clear, normal states
- `test/shell/app_shell_test.dart` - Updated to override dailyPlanProvider for new HomeScreen

## Decisions Made
- Used simpler stream-driven completion with local `_completingTaskIds` Set instead of AnimatedList. The stream naturally re-emits without completed tasks (nextDueDate moves to future), and the local Set provides immediate visual feedback via SizeTransition + SlideTransition animation during the ~300ms before re-emission.
- DailyPlanTaskRow is a plain StatelessWidget (not ConsumerWidget). It receives `TaskWithRoom`, `showCheckbox`, and `onCompleted` callback from the parent. This keeps it decoupled from Riverpod and easily testable.
- The "no tasks" empty state now uses `dailyPlanNoTasks` ("Noch keine Aufgaben angelegt") instead of `homeEmptyTitle` ("Noch nichts zu tun!") for more specific messaging in the daily plan context.

## Deviations from Plan

### Auto-fixed Issues

**1. [Rule 1 - Bug] Updated app_shell_test.dart for new HomeScreen dependency**
- **Found during:** Task 2 (HomeScreen rewrite)
- **Issue:** Existing app_shell_test.dart expected `homeEmptyTitle` text on home tab, but new HomeScreen watches `dailyPlanProvider` and shows different empty state text
- **Fix:** Added `dailyPlanProvider` override to test's ProviderScope, updated assertion from "Noch nichts zu tun!" to "Noch keine Aufgaben angelegt"
- **Files modified:** test/shell/app_shell_test.dart
- **Verification:** Full test suite passes (72/72)
- **Committed in:** 444213e (Task 2 commit)

---

**Total deviations:** 1 auto-fixed (1 bug fix)
**Impact on plan:** Necessary fix for existing test compatibility. No scope creep.

## Issues Encountered
- "Heute" text appeared twice in overdue+today test (section header + relative date for today task). Fixed by using `findsAtLeast(1)` matcher instead of `findsOneWidget`.

## User Setup Required

None - no external service configuration required.

## Next Phase Readiness
- Daily plan UI complete: HomeScreen shows progress, overdue, today, and tomorrow sections
- Plan 03 (verification gate) can proceed to validate full Phase 3 integration
- CLEAN-01 verified: room cards already display cleanliness indicator from Phase 2
- 72/72 tests passing, dart analyze clean on production code

## Self-Check: PASSED

All 5 files verified present on disk. All 2 commit hashes verified in git log.

---
*Phase: 03-daily-plan-and-cleanliness*
*Completed: 2026-03-16*
