chore(10-01): delete orphaned v1.0 daily plan presentation files and remove DailyPlanState
- Delete daily_plan_providers.dart (orphaned since Phase 5 calendar strip) - Delete daily_plan_task_row.dart (orphaned since Phase 5 calendar strip) - Delete progress_card.dart (orphaned since Phase 5 calendar strip) - Remove DailyPlanState class from daily_plan_models.dart (only used by deleted files) - Preserve TaskWithRoom class (still used by calendar system)
This commit is contained in:
@@ -13,19 +13,3 @@ class TaskWithRoom {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Daily plan data categorized into sections with progress tracking.
|
|
||||||
class DailyPlanState {
|
|
||||||
final List<TaskWithRoom> overdueTasks;
|
|
||||||
final List<TaskWithRoom> todayTasks;
|
|
||||||
final List<TaskWithRoom> tomorrowTasks;
|
|
||||||
final int completedTodayCount;
|
|
||||||
final int totalTodayCount;
|
|
||||||
|
|
||||||
const DailyPlanState({
|
|
||||||
required this.overdueTasks,
|
|
||||||
required this.todayTasks,
|
|
||||||
required this.tomorrowTasks,
|
|
||||||
required this.completedTodayCount,
|
|
||||||
required this.totalTodayCount,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
||||||
|
|
||||||
import 'package:household_keeper/core/providers/database_provider.dart';
|
|
||||||
import 'package:household_keeper/features/home/domain/daily_plan_models.dart';
|
|
||||||
|
|
||||||
/// Reactive daily plan data: tasks categorized into overdue/today/tomorrow
|
|
||||||
/// with progress tracking.
|
|
||||||
///
|
|
||||||
/// Defined manually (not @riverpod) because riverpod_generator has trouble
|
|
||||||
/// with drift's generated [Task] type. Same pattern as [tasksInRoomProvider].
|
|
||||||
final dailyPlanProvider =
|
|
||||||
StreamProvider.autoDispose<DailyPlanState>((ref) {
|
|
||||||
final db = ref.watch(appDatabaseProvider);
|
|
||||||
final taskStream = db.dailyPlanDao.watchAllTasksWithRoomName();
|
|
||||||
|
|
||||||
return taskStream.asyncMap((allTasks) async {
|
|
||||||
// Get today's completion count (latest value from stream)
|
|
||||||
final completedToday =
|
|
||||||
await db.dailyPlanDao.watchCompletionsToday().first;
|
|
||||||
|
|
||||||
final now = DateTime.now();
|
|
||||||
final today = DateTime(now.year, now.month, now.day);
|
|
||||||
final tomorrow = today.add(const Duration(days: 1));
|
|
||||||
final dayAfterTomorrow = tomorrow.add(const Duration(days: 1));
|
|
||||||
|
|
||||||
final overdue = <TaskWithRoom>[];
|
|
||||||
final todayList = <TaskWithRoom>[];
|
|
||||||
final tomorrowList = <TaskWithRoom>[];
|
|
||||||
|
|
||||||
for (final tw in allTasks) {
|
|
||||||
final dueDate = DateTime(
|
|
||||||
tw.task.nextDueDate.year,
|
|
||||||
tw.task.nextDueDate.month,
|
|
||||||
tw.task.nextDueDate.day,
|
|
||||||
);
|
|
||||||
if (dueDate.isBefore(today)) {
|
|
||||||
overdue.add(tw);
|
|
||||||
} else if (dueDate.isBefore(tomorrow)) {
|
|
||||||
todayList.add(tw);
|
|
||||||
} else if (dueDate.isBefore(dayAfterTomorrow)) {
|
|
||||||
tomorrowList.add(tw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// totalTodayCount includes completedTodayCount so the denominator
|
|
||||||
// stays stable as tasks are completed (their nextDueDate moves to
|
|
||||||
// the future, shrinking overdue+today, but completedToday grows).
|
|
||||||
return DailyPlanState(
|
|
||||||
overdueTasks: overdue,
|
|
||||||
todayTasks: todayList,
|
|
||||||
tomorrowTasks: tomorrowList,
|
|
||||||
completedTodayCount: completedToday,
|
|
||||||
totalTodayCount: overdue.length + todayList.length + completedToday,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
|
|
||||||
import 'package:household_keeper/features/home/domain/daily_plan_models.dart';
|
|
||||||
import 'package:household_keeper/features/tasks/domain/relative_date.dart';
|
|
||||||
|
|
||||||
/// Warm coral/terracotta color for overdue indicators.
|
|
||||||
const _overdueColor = Color(0xFFE07A5F);
|
|
||||||
|
|
||||||
/// A task row for the daily plan screen.
|
|
||||||
///
|
|
||||||
/// Shows task name, a tappable room name tag (navigates to room task list),
|
|
||||||
/// relative due date (coral if overdue), and an optional checkbox.
|
|
||||||
///
|
|
||||||
/// Per user decisions:
|
|
||||||
/// - NO onTap or onLongPress on the row itself
|
|
||||||
/// - Only the checkbox and room name tag are interactive
|
|
||||||
/// - Checkbox is hidden for tomorrow (read-only preview) tasks
|
|
||||||
class DailyPlanTaskRow extends StatelessWidget {
|
|
||||||
const DailyPlanTaskRow({
|
|
||||||
super.key,
|
|
||||||
required this.taskWithRoom,
|
|
||||||
required this.showCheckbox,
|
|
||||||
this.onCompleted,
|
|
||||||
});
|
|
||||||
|
|
||||||
final TaskWithRoom taskWithRoom;
|
|
||||||
final bool showCheckbox;
|
|
||||||
final VoidCallback? onCompleted;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final theme = Theme.of(context);
|
|
||||||
final task = taskWithRoom.task;
|
|
||||||
|
|
||||||
final now = DateTime.now();
|
|
||||||
final today = DateTime(now.year, now.month, now.day);
|
|
||||||
final dueDate = DateTime(
|
|
||||||
task.nextDueDate.year,
|
|
||||||
task.nextDueDate.month,
|
|
||||||
task.nextDueDate.day,
|
|
||||||
);
|
|
||||||
final isOverdue = dueDate.isBefore(today);
|
|
||||||
final relativeDateText = formatRelativeDate(task.nextDueDate, now);
|
|
||||||
|
|
||||||
return ListTile(
|
|
||||||
leading: showCheckbox
|
|
||||||
? Checkbox(
|
|
||||||
value: false,
|
|
||||||
onChanged: (_) => onCompleted?.call(),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
title: Text(
|
|
||||||
task.name,
|
|
||||||
style: theme.textTheme.titleMedium,
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
subtitle: Row(
|
|
||||||
children: [
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Flexible(
|
|
||||||
child: Text(
|
|
||||||
relativeDateText,
|
|
||||||
style: theme.textTheme.bodySmall?.copyWith(
|
|
||||||
color: isOverdue
|
|
||||||
? _overdueColor
|
|
||||||
: theme.colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:household_keeper/l10n/app_localizations.dart';
|
|
||||||
|
|
||||||
/// A progress banner card showing "X von Y erledigt" with a linear
|
|
||||||
/// progress bar. Displayed at the top of the daily plan screen.
|
|
||||||
class ProgressCard extends StatelessWidget {
|
|
||||||
const ProgressCard({
|
|
||||||
super.key,
|
|
||||||
required this.completed,
|
|
||||||
required this.total,
|
|
||||||
});
|
|
||||||
|
|
||||||
final int completed;
|
|
||||||
final int total;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final l10n = AppLocalizations.of(context);
|
|
||||||
final theme = Theme.of(context);
|
|
||||||
final colorScheme = theme.colorScheme;
|
|
||||||
|
|
||||||
return Card(
|
|
||||||
margin: const EdgeInsets.all(16),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
l10n.dailyPlanProgress(completed, total),
|
|
||||||
style: theme.textTheme.titleMedium?.copyWith(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
child: LinearProgressIndicator(
|
|
||||||
value: total > 0 ? completed / total : 0.0,
|
|
||||||
minHeight: 8,
|
|
||||||
backgroundColor: colorScheme.surfaceContainerHighest,
|
|
||||||
color: colorScheme.primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user