feat(05-02): build CalendarStrip, CalendarTaskRow, CalendarDayList widgets
- Add totalTaskCount field to CalendarDayState to distinguish first-run from celebration - Add getTaskCount() to CalendarDao (SELECT COUNT from tasks) - CalendarStrip: 181-day horizontal scroll with German abbreviations, today highlighting, month boundary labels, scroll-to-today controller - CalendarTaskRow: task name + room tag chip + checkbox, no relative date, isOverdue coral styling - CalendarDayList: loading/error/first-run-empty/empty-day/celebration/has-tasks states, overdue section (today only), slide-out completion animation - Update home_screen_test.dart and app_shell_test.dart to test new calendar providers instead of dailyPlanProvider
This commit is contained in:
69
lib/features/home/presentation/calendar_task_row.dart
Normal file
69
lib/features/home/presentation/calendar_task_row.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'package:household_keeper/features/home/domain/daily_plan_models.dart';
|
||||
|
||||
/// Warm coral/terracotta color for overdue task name text.
|
||||
const _overdueColor = Color(0xFFE07A5F);
|
||||
|
||||
/// A task row adapted for the calendar day list.
|
||||
///
|
||||
/// Shows task name, a tappable room tag (navigates to room task list),
|
||||
/// and an interactive checkbox. Does NOT show a relative date — the
|
||||
/// calendar strip already communicates which day is selected.
|
||||
///
|
||||
/// When [isOverdue] is true the task name uses coral text to visually
|
||||
/// distinguish overdue carry-over from today's regular tasks.
|
||||
class CalendarTaskRow extends StatelessWidget {
|
||||
const CalendarTaskRow({
|
||||
super.key,
|
||||
required this.taskWithRoom,
|
||||
required this.onCompleted,
|
||||
this.isOverdue = false,
|
||||
});
|
||||
|
||||
final TaskWithRoom taskWithRoom;
|
||||
|
||||
/// Called when the user checks the checkbox.
|
||||
final VoidCallback onCompleted;
|
||||
|
||||
/// When true, task name is rendered in coral color.
|
||||
final bool isOverdue;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final task = taskWithRoom.task;
|
||||
|
||||
return ListTile(
|
||||
leading: Checkbox(
|
||||
value: false,
|
||||
onChanged: (_) => onCompleted(),
|
||||
),
|
||||
title: Text(
|
||||
task.name,
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
color: isOverdue ? _overdueColor : null,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: GestureDetector(
|
||||
onTap: () => context.go('/rooms/${taskWithRoom.roomId}'),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.secondaryContainer,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
taskWithRoom.roomName,
|
||||
style: theme.textTheme.labelSmall?.copyWith(
|
||||
color: theme.colorScheme.onSecondaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user