checkpoint: focus seed 1.0.1 localized dev switch

This commit is contained in:
2026-06-11 23:35:49 +08:00
parent c51abdfb73
commit d06dc35ee6
72 changed files with 6155 additions and 1390 deletions
+49
View File
@@ -0,0 +1,49 @@
import '../core/date_keys.dart';
import 'app_state.dart';
import 'growth_stage.dart';
class TodayProgress {
const TodayProgress({
required this.dateKey,
required this.intention,
required this.focusMinutes,
required this.completedHabits,
required this.totalHabits,
required this.hasReflection,
required this.growthStage,
});
factory TodayProgress.fromState(AppState state, String dateKey) {
return TodayProgress(
dateKey: dateKey,
intention: state.activeAnchor(dateKey),
focusMinutes: minutesForDate(state.sessions, dateKey),
completedHabits:
state.habits
.where((habit) => habit.completedDates.contains(dateKey))
.length,
totalHabits: state.habits.length,
hasReflection: state.reflections.any((entry) => entry.dateKey == dateKey),
growthStage: growthStageFor(state, dateKey),
);
}
final String dateKey;
final String intention;
final int focusMinutes;
final int completedHabits;
final int totalHabits;
final bool hasReflection;
final GrowthStage growthStage;
bool get hasIntention => intention.isNotEmpty;
bool get hasFocus => focusMinutes > 0;
bool get hasHabits => completedHabits > 0;
int get completedSteps =>
[
hasIntention,
hasFocus,
hasHabits,
hasReflection,
].where((complete) => complete).length;
}