Files
HouseHoldKeaper/lib/features/home/presentation/calendar_task_row.dart
Jean-Luc Makiola d220dbe5ce
All checks were successful
Build and Release to F-Droid / build-and-deploy (push) Successful in 10m30s
test(TaskListScreen): add integration tests for filtered and overdue task states
- Covers empty states, celebration state, and scheduled/overdue task rendering
- Verifies proper checkbox behavior for future tasks
- Tests AppBar for sort dropdown, edit/delete actions, and calendar strip
- Adds necessary test helpers and overrides for room-specific tasks
2026-03-16 23:35:17 +01:00

84 lines
2.6 KiB
Dart

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,
this.showRoomTag = true,
this.canComplete = true,
});
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;
/// When false, the room tag subtitle is hidden (e.g. in room-scoped view).
final bool showRoomTag;
/// When false, the checkbox is disabled (e.g. for future tasks).
final bool canComplete;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final task = taskWithRoom.task;
return ListTile(
onTap: () => context.go(
'/rooms/${taskWithRoom.roomId}/tasks/${taskWithRoom.task.id}',
),
leading: Checkbox(
value: false,
onChanged: canComplete ? (_) => onCompleted() : null,
),
title: Text(
task.name,
style: theme.textTheme.titleMedium?.copyWith(
color: isOverdue ? _overdueColor : null,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
subtitle: showRoomTag
? 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,
),
),
),
)
: null,
);
}
}