Files
2026-03-18 22:47:04 +01:00

106 lines
5.0 KiB
Markdown

---
phase: 09-task-creation-ux
plan: 01
subsystem: ui
tags: [flutter, dart, l10n, frequency-picker, choice-chip, segmented-button]
# Dependency graph
requires: []
provides:
- Reworked frequency picker with 4 shortcut chips (Täglich, Wöchentlich, Alle 2 Wochen, Monatlich)
- Always-visible freeform "Alle [N] [unit]" picker replacing hidden Custom mode
- Bidirectional chip/picker sync via _ShortcutFrequency enum
- Unified _resolveFrequency() reading exclusively from picker (single source of truth)
- Edit mode loading for all 8 IntervalType values including quarterly and yearly
affects: []
# Tech tracking
tech-stack:
added: []
patterns:
- "Shortcut chip + freeform picker: ChoiceChip row above always-visible SegmentedButton picker"
- "Bidirectional sync: chip tapped populates picker; picker edited recalculates chip highlight via fromPickerValues()"
- "Single source of truth: _resolveFrequency() always reads from picker, never from a preset reference"
key-files:
created: []
modified:
- lib/features/tasks/presentation/task_form_screen.dart
- lib/l10n/app_de.arb
- lib/l10n/app_localizations.dart
- lib/l10n/app_localizations_de.dart
key-decisions:
- "Picker is single source of truth: _resolveFrequency() reads from _customIntervalController + _customUnit always"
- "_ShortcutFrequency enum with toPickerValues() and fromPickerValues() handles bidirectional sync without manual mapping"
- "Named IntervalTypes (daily/weekly/biweekly/monthly) used for canonical values; only everyNDays for 3+ weeks"
- "Quarterly (3 months) and yearly (12 months) displayed correctly in picker with no chip highlighted"
patterns-established:
- "Shortcut chip pattern: enum with toPickerValues() / fromPickerValues() for bidirectional picker sync"
requirements-completed: [TCX-01, TCX-02, TCX-03, TCX-04]
# Metrics
duration: 2min
completed: 2026-03-18
---
# Phase 9 Plan 01: Task Creation UX — Frequency Picker Rework Summary
**4 shortcut chips (Täglich/Wöchentlich/Alle 2 Wochen/Monatlich) + always-visible freeform picker replacing the 10-chip grid with hidden Custom mode**
## Performance
- **Duration:** 2 min
- **Started:** 2026-03-18T21:43:24Z
- **Completed:** 2026-03-18T21:45:30Z
- **Tasks:** 1 (+ 1 auto-approved checkpoint)
- **Files modified:** 4
## Accomplishments
- Replaced 10-chip preset grid and hidden "Benutzerdefiniert" mode with 4 shortcut chips + always-visible freeform picker
- Implemented bidirectional sync: tapping a chip populates the picker; editing the picker recalculates chip highlight
- Simplified _resolveFrequency() to read exclusively from the picker (single source of truth), using named IntervalTypes for canonical values
- Edit mode correctly loads all 8 IntervalType values (daily, everyNDays, weekly, biweekly, monthly, everyNMonths, quarterly, yearly) into the picker and highlights the matching shortcut chip where applicable
## Task Commits
Each task was committed atomically:
1. **Task 1: Rework frequency picker — shortcut chips + freeform picker** - `8a0b69b` (feat)
2. **Task 2: Verify frequency picker UX** - auto-approved (checkpoint:human-verify, auto_advance=true)
**Plan metadata:** (docs commit follows)
## Files Created/Modified
- `lib/features/tasks/presentation/task_form_screen.dart` - Reworked frequency picker: removed _selectedPreset and _isCustomFrequency fields; added _ShortcutFrequency enum and _activeShortcut state; replaced _buildFrequencySelector() with shortcut chips + always-visible picker; renamed _buildCustomFrequencyInput to _buildFrequencyPickerRow with bidirectional sync; simplified _resolveFrequency() to picker-only
- `lib/l10n/app_de.arb` - Added frequencyShortcutDaily/Weekly/Biweekly/Monthly keys
- `lib/l10n/app_localizations.dart` - Regenerated to include new shortcut string getters
- `lib/l10n/app_localizations_de.dart` - Regenerated with German translations (Täglich, Wöchentlich, Alle 2 Wochen, Monatlich)
## Decisions Made
- Picker is single source of truth: _resolveFrequency() reads from _customIntervalController + _customUnit always, regardless of which chip is highlighted
- _ShortcutFrequency enum with toPickerValues() and static fromPickerValues() cleanly handles bidirectional sync without manual if-chain mapping in each callback
- Named IntervalTypes (daily/weekly/biweekly/monthly) used for canonical values (e.g., weekly has days=1, biweekly has days=14) matching existing DB records; only everyNDays used for 3+ weeks
- Quarterly (3 months) and yearly (12 months) round-trip correctly: loaded as "3 Monate" / "12 Monate" in picker with no chip highlighted
## Deviations from Plan
None - plan executed exactly as written.
## Issues Encountered
None.
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
- Frequency picker rework complete; TaskFormScreen is ready for further UX improvements
- All 144 existing tests pass, dart analyze is clean
- No changes to frequency.dart, no DB migration, no new screens
---
*Phase: 09-task-creation-ux*
*Completed: 2026-03-18*