Skip to content

feat(timer): display collapsible session summary on timer screen - #29

Merged
Adamskiee merged 3 commits into
mainfrom
feat/timer-session-summary
Nov 5, 2026
Merged

Adamskiee merged 3 commits into
mainfrom
feat/timer-session-summary

Conversation

@Adamskiee

Copy link
Copy Markdown
Owner

Overview

Displays a cumulative session duration breakdown on ActiveTimerScreen during active routine runs. Users can track their accumulated Total, Focus, and Rest durations in real time. The card is designed to be distraction-free and is collapsible by default to preserve focus.

Changes

1. Engine Metrics (timer_engine)

  • Exposed totalFocusElapsedMs and totalRestElapsedMs on TimerRunState by aggregating completed phases and active phase durations matching PhaseKind.focus and PhaseKind.rest.
  • Guarantees the invariant totalFocusElapsedMs + totalRestElapsedMs == totalActiveElapsedMs.

2. State Mapping (lib/src/features/timer)

  • Extended TimerDisplayState with totalSessionElapsedMs, totalFocusElapsedMs, and totalRestElapsedMs.
  • Updated ActiveTimerController to map these metrics from TimerRunState across initial start, timer ticks, and phase transitions.

3. Presentation & Interaction (SessionSummaryCard & ActiveTimerScreen)

  • Created SessionSummaryCard:
    • Collapsed State: Default state showing a compact header with Icons.query_stats, 'Session Summary' label, and an expand chevron.
    • Expansion: Tapping the card header or the chevron toggle button smoothly expands the card (AnimatedSize) to show individual metric tiles for Total, Focus, and Rest.
    • Collapse: Tapping again smoothly collapses the card back to the compact header.
  • Separated the mini-player play/pause IconButton from the outer InkWell in ActiveTimerMiniPlayer so toggling play/pause does not inadvertently push ActiveTimerScreen.
  • Ensured ActiveTimerScreen minimize button and completion "Done" button reliably pop the screen route.

Verification

Automated Tests

  • Timer Engine: cd packages/timer_engine && flutter test test/domain/timer_run_state_test.dart (verified multi-phase focus/rest tallies)
  • Timer Controller: flutter test test/features/timer/controllers/active_timer_controller_test.dart (verified state mapping on ticks & transitions)
  • Widget Tests:
    • flutter test test/features/timer/presentation/widgets/session_summary_card_test.dart (verified collapsed default, expansion, and collapse toggle)
    • flutter test test/features/timer/presentation/active_timer_screen_test.dart (verified rendering, scrolling, expansion, and minimize button)
    • flutter test test/features/timer/presentation/active_timer_mini_player_test.dart (verified play/pause toggle does not expand screen)
  • Full Suite:
    • flutter test test/features/timer (62 tests passed)
    • CI=true flutter test test/ (349 tests passed)
    • CI=true flutter test test/integration/ (All E2E flow tests passed)
  • Static Analysis & Formatting:
    • melos run format (Clean across all packages)
    • melos run analyze / flutter analyze --fatal-infos (0 issues across all 5 packages)

Add a SessionSummaryCard to ActiveTimerScreen showing accumulated Total,
Focus, and Rest elapsed durations for the active routine session.

- Expose totalFocusElapsedMs and totalRestElapsedMs getters on TimerRunState.
- Add totalSessionElapsedMs, totalFocusElapsedMs, and totalRestElapsedMs
  to TimerDisplayState.
- Map run metrics into display state in ActiveTimerController.
- Render SessionSummaryCard beneath timer controls with theme styling.
- Add comprehensive unit, controller, widget, and integration tests.
- Move the play/pause IconButton outside the mini-player InkWell so toggling does not inadvertently expand ActiveTimerScreen
- Only wrap the timer text info and progress content in InkWell for intentional expansion
- Use Navigator.canPop() and Navigator.pop() for timer minimize and done actions to ensure reliable closing
- Add regression widget tests verifying play/pause does not expand route and minimize button closes ActiveTimerScreen
- Convert SessionSummaryCard to a stateful collapsible card collapsed by default
- Allow tapping the card header or the expand/collapse chevron button to toggle
- Smoothly animate the expansion and collapse of the Total, Focus, and Rest metrics
- Update widget tests to cover initial collapsed state, expansion, and re-collapsing
@Adamskiee
Adamskiee merged commit ebd1d77 into main Nov 5, 2026
13 checks passed
@Adamskiee
Adamskiee deleted the feat/timer-session-summary branch November 5, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant