9.1 KiB
9.1 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | must_haves | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 02-rooms-and-tasks | 04 | execute | 3 |
|
|
true |
|
|
Purpose: Delivers TMPL-01 and TMPL-02 -- the template-driven task creation that makes the app immediately useful. Users create a room and get relevant German-language task suggestions. Output: Template picker bottom sheet, updated room form with template flow integration.
<execution_context> @/home/jlmak/.claude/get-shit-done/workflows/execute-plan.md @/home/jlmak/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/02-rooms-and-tasks/2-CONTEXT.md @.planning/phases/02-rooms-and-tasks/02-RESEARCH.md @.planning/phases/02-rooms-and-tasks/02-01-SUMMARY.md @.planning/phases/02-rooms-and-tasks/02-02-SUMMARY.md @.planning/phases/02-rooms-and-tasks/02-03-SUMMARY.mdFrom lib/features/templates/data/task_templates.dart:
class TaskTemplate {
final String name;
final String? description;
final IntervalType intervalType;
final int intervalDays;
final EffortLevel effortLevel;
const TaskTemplate({...});
}
const Map<String, List<TaskTemplate>> roomTemplates = { ... };
String? detectRoomType(String roomName);
From lib/features/rooms/presentation/room_form_screen.dart:
// Full-screen form with name + icon fields
// On save: calls roomActions.createRoom(name, iconName) which returns roomId
// After save: context.pop() currently
// MODIFY: after save for new rooms, check detectRoomType before popping
From lib/features/tasks/presentation/task_providers.dart:
@riverpod
class TaskActions extends _$TaskActions {
Future<int> createTask({
required int roomId,
required String name,
String? description,
required IntervalType intervalType,
required int intervalDays,
int? anchorDay,
required EffortLevel effortLevel,
required DateTime nextDueDate,
}) async { ... }
}
Constructor parameters:
- `String roomType` -- the detected room type key
- `List<TaskTemplate> templates` -- the template list for this room type
- `void Function(List<TaskTemplate> selected) onConfirm` -- callback with selected templates
UI structure:
- Title: "Aufgaben aus Vorlagen hinzufuegen?" (from ARB)
- Subtitle hint: the detected room type display name (capitalize first letter)
- `ListView` of `CheckboxListTile` widgets, one per template
- Each tile shows: template name as title, frequency label as subtitle (e.g. "Woechentlich - Mittel")
- **All unchecked by default** per user decision
- Bottom action row: "Ueberspringen" (skip/cancel) button and "Hinzufuegen" (add) button
- "Hinzufuegen" button only enabled when at least one template is checked
- Use `showModalBottomSheet` with `isScrollControlled: true` and `DraggableScrollableSheet` for long lists
- Track checked state with a `Set<int>` (template index)
**lib/l10n/app_de.arb**: Add template-related keys:
- "templatePickerTitle": "Aufgaben aus Vorlagen hinzuf\u00fcgen?"
- "templatePickerSkip": "\u00dcberspringen"
- "templatePickerAdd": "Hinzuf\u00fcgen"
- "templatePickerSelected": "{count} ausgew\u00e4hlt"
cd /home/jlmak/Projects/jlmak/HouseHoldKeaper && dart analyze lib/features/templates/presentation/ && flutter test
Template picker bottom sheet displays checklist of templates with frequency/effort info, all unchecked by default. Skip and add buttons. Localized German strings.
Task 2: Wire template flow into room creation
lib/features/rooms/presentation/room_form_screen.dart
Modify the room form screen's save flow for NEW rooms (not edit) to integrate the template selection:
1. After `roomActions.createRoom(name, iconName)` returns the new `roomId`:
2. Call `detectRoomType(name)` to check if the room name matches a known type
3. **If room type detected** (not null):
- Look up `roomTemplates[roomType]` to get the template list
- Show `TemplatePickerSheet` via `showModalBottomSheet`
- If user selects templates and confirms:
- For each selected `TaskTemplate`, call `taskActions.createTask()` with:
- `roomId`: the newly created room ID
- `name`: template.name
- `description`: template.description
- `intervalType`: template.intervalType
- `intervalDays`: template.intervalDays
- `anchorDay`: set based on interval type (for calendar-anchored: today's day-of-month)
- `effortLevel`: template.effortLevel
- `nextDueDate`: today (first due date = today for all template tasks)
- After creating all tasks, navigate to the new room: `context.go('/rooms/$roomId')`
- If user skips (taps "Ueberspringen"): navigate to `/rooms/$roomId` without creating tasks
4. **If no room type detected** (null):
- Navigate directly to `/rooms/$roomId` (no template prompt per user decision: "Users can create fully custom rooms with no template prompt if no room type matches")
Important per user decision: "The template prompt after room creation should feel like a helpful suggestion, not a required step -- easy to dismiss"
For EDIT mode: no template prompt (only on creation). The save flow for edit stays as-is (update room, pop).
Read `taskActionsProvider` via `ref.read(taskActionsProvider.notifier)` for the mutations (not watch -- this is in a callback).
cd /home/jlmak/Projects/jlmak/HouseHoldKeaper && dart analyze lib/features/rooms/presentation/ lib/features/templates/presentation/ && flutter test
Room creation flow: save room -> detect room type -> show template picker if match -> create selected templates as tasks -> navigate to room. Custom rooms skip templates. Edit mode unaffected. All existing tests pass.
```bash
cd /home/jlmak/Projects/jlmak/HouseHoldKeaper && dart analyze && flutter test
```
All code analyzes clean. All tests pass. Template selection flow is wired into room creation.
<success_criteria>
- Creating a room with a recognized name (e.g. "Kueche") triggers template picker
- Template picker shows relevant German task templates, all unchecked
- Checking templates and confirming creates them as tasks in the room
- Skipping creates the room without tasks
- Unrecognized room names skip template prompt entirely
- Edit mode does not show template prompt
- All 14 room types accessible via detectRoomType </success_criteria>