focus-flow/apps/focus_flow_flutter/lib/theme/scheduler_visual_tokens.dart

92 lines
3.4 KiB
Dart

// SPDX-FileCopyrightText: 2026 FocusFlow contributors
// SPDX-License-Identifier: AGPL-3.0-only
/// Defines Scheduler Visual Tokens styling for the FocusFlow Flutter UI.
library;
import 'package:flutter/material.dart';
import 'package:scheduler_core/scheduler_core.dart';
/// Maps scheduler domain tokens to Flutter colors and icons.
abstract final class SchedulerVisualTokens {
/// Returns the color associated with a project color [token].
static Color projectColor(String token) {
return switch (token) {
'home' => const Color(0xFF68B0AB),
'inbox' => const Color(0xFFB7B56D),
_ => const Color(0xFFB8C7CC),
};
}
/// Returns the background color associated with a timeline background token.
static Color backgroundColor(
TimelineBackgroundToken token,
ColorScheme scheme,
) {
return switch (token) {
TimelineBackgroundToken.flexible => scheme.surfaceContainerHighest,
TimelineBackgroundToken.inflexible => const Color(0xFF1E3641),
TimelineBackgroundToken.critical => const Color(0xFF463638),
TimelineBackgroundToken.locked => const Color(0xFF252B30),
TimelineBackgroundToken.surprise => const Color(0xFF303C2A),
TimelineBackgroundToken.freeSlot => const Color(0xFF243B3A),
};
}
/// Returns the icon associated with a task [type].
static IconData taskIcon(TaskType type) {
return switch (type) {
TaskType.flexible => Icons.task_alt,
TaskType.inflexible => Icons.event,
TaskType.critical => Icons.priority_high,
TaskType.locked => Icons.lock_outline,
TaskType.surprise => Icons.bolt,
TaskType.freeSlot => Icons.self_improvement,
};
}
/// Returns the icon associated with a reward token.
static IconData rewardIcon(TimelineRewardIconToken token) {
return switch (token) {
TimelineRewardIconToken.notSet => Icons.remove_circle_outline,
TimelineRewardIconToken.veryLow => Icons.looks_one_outlined,
TimelineRewardIconToken.low => Icons.looks_two_outlined,
TimelineRewardIconToken.medium => Icons.looks_3_outlined,
TimelineRewardIconToken.high => Icons.looks_4_outlined,
TimelineRewardIconToken.veryHigh => Icons.looks_5_outlined,
};
}
/// Returns the icon associated with a difficulty token.
static IconData difficultyIcon(TimelineDifficultyIconToken token) {
return switch (token) {
TimelineDifficultyIconToken.notSet => Icons.remove_circle_outline,
TimelineDifficultyIconToken.veryEasy => Icons.filter_1,
TimelineDifficultyIconToken.easy => Icons.filter_2,
TimelineDifficultyIconToken.medium => Icons.filter_3,
TimelineDifficultyIconToken.hard => Icons.filter_4,
TimelineDifficultyIconToken.veryHard => Icons.filter_5,
};
}
/// Returns the icon associated with a backlog staleness marker.
static IconData stalenessIcon(BacklogStalenessMarker marker) {
return switch (marker) {
BacklogStalenessMarker.green => Icons.circle,
BacklogStalenessMarker.blue => Icons.adjust,
BacklogStalenessMarker.purple => Icons.change_history,
};
}
/// Returns the color associated with a backlog staleness marker.
static Color stalenessColor(
BacklogStalenessMarker marker,
ColorScheme scheme,
) {
return switch (marker) {
BacklogStalenessMarker.green => const Color(0xFF76B981),
BacklogStalenessMarker.blue => const Color(0xFF80A7D8),
BacklogStalenessMarker.purple => const Color(0xFFB594D1),
};
}
}