feat(02-01): Drift tables, DAOs, scheduling utility, domain models with tests
- Add Rooms, Tasks, TaskCompletions Drift tables with schema v2 migration - Create RoomsDao with CRUD, watchAll, watchWithStats, cascade delete, reorder - Create TasksDao with CRUD, watchInRoom (sorted by due), completeTask, overdue detection - Implement calculateNextDueDate and catchUpToPresent pure scheduling functions - Define IntervalType enum (8 types), EffortLevel enum, FrequencyInterval model - Add formatRelativeDate German formatter and curatedRoomIcons icon list - Enable PRAGMA foreign_keys in beforeOpen migration strategy - All 30 unit tests passing (17 scheduling + 6 rooms DAO + 7 tasks DAO) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
40
lib/features/rooms/domain/room_icons.dart
Normal file
40
lib/features/rooms/domain/room_icons.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Curated list of ~25 household Material Icons for the room icon picker.
|
||||
const List<({String name, IconData icon})> curatedRoomIcons = [
|
||||
(name: 'kitchen', icon: Icons.kitchen),
|
||||
(name: 'bathtub', icon: Icons.bathtub),
|
||||
(name: 'bed', icon: Icons.bed),
|
||||
(name: 'living', icon: Icons.living),
|
||||
(name: 'weekend', icon: Icons.weekend),
|
||||
(name: 'door_front', icon: Icons.door_front_door),
|
||||
(name: 'desk', icon: Icons.desk),
|
||||
(name: 'garage', icon: Icons.garage),
|
||||
(name: 'balcony', icon: Icons.balcony),
|
||||
(name: 'local_laundry', icon: Icons.local_laundry_service),
|
||||
(name: 'stairs', icon: Icons.stairs),
|
||||
(name: 'child_care', icon: Icons.child_care),
|
||||
(name: 'single_bed', icon: Icons.single_bed),
|
||||
(name: 'dining', icon: Icons.dining),
|
||||
(name: 'yard', icon: Icons.yard),
|
||||
(name: 'grass', icon: Icons.grass),
|
||||
(name: 'home', icon: Icons.home),
|
||||
(name: 'storage', icon: Icons.inventory_2),
|
||||
(name: 'window', icon: Icons.window),
|
||||
(name: 'cleaning', icon: Icons.cleaning_services),
|
||||
(name: 'iron', icon: Icons.iron),
|
||||
(name: 'microwave', icon: Icons.microwave),
|
||||
(name: 'shower', icon: Icons.shower),
|
||||
(name: 'chair', icon: Icons.chair),
|
||||
(name: 'door_sliding', icon: Icons.door_sliding),
|
||||
];
|
||||
|
||||
/// Map a stored icon name string back to its IconData.
|
||||
///
|
||||
/// Returns [Icons.home] as fallback if the name is not found.
|
||||
IconData mapIconName(String name) {
|
||||
for (final entry in curatedRoomIcons) {
|
||||
if (entry.name == name) return entry.icon;
|
||||
}
|
||||
return Icons.home;
|
||||
}
|
||||
Reference in New Issue
Block a user