Files
HouseHoldKeaper/lib/features/home/presentation/calendar_task_row.dart
Jean-Luc Makiola 8cbe989aeb feat(11-02): render pre-populated tasks with muted visual distinction in calendar UI
- Add isPrePopulated parameter to CalendarTaskRow (default false, backward compat)
- Wrap ListTile in Opacity(0.55) when isPrePopulated to indicate upcoming tasks
- Render 'Demnächst' section in CalendarDayList with muted section header
- Update _buildAnimatedTaskRow to accept and forward isPrePopulated flag
- Update _CompletingTaskRow to accept isPrePopulated (always false during animation)
- Update celebration check to include prePopulatedTasks.isEmpty condition
- Update _completingTaskIds cleanup to also check prePopulatedTasks
2026-04-03 21:26:53 +02:00

95 lines
3.1 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.
///
/// When [isPrePopulated] is true the entire row is rendered at 0.55 opacity
/// to indicate it is not yet due (visible within interval window, but due
/// date is in the future).
class CalendarTaskRow extends StatelessWidget {
const CalendarTaskRow({
super.key,
required this.taskWithRoom,
required this.onCompleted,
this.isOverdue = false,
this.showRoomTag = true,
this.canComplete = true,
this.isPrePopulated = 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;
/// 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;
/// When true, the row is rendered at 0.55 opacity to indicate an
/// upcoming (not-yet-due) pre-populated task within its interval window.
final bool isPrePopulated;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final task = taskWithRoom.task;
final tile = 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,
);
return isPrePopulated ? Opacity(opacity: 0.55, child: tile) : tile;
}
}