Files
gps-speedo/lib/models/theme_model.dart
T
Mikkeli Matlock 5122be4bc1 feat(01-01): extract models and move config files to new structure
- Move SpeedUnit enum to config/speed_unit.dart
- Move ColorTheme/ColorThemes classes to config/color_themes.dart
- Extract ProcessedGpsData model from gps_data_manager to models/
- Create OverlayMessage typed class for overlay IPC (replaces raw Maps)
- Create ThemeModel with palette rotation and state management
2026-02-09 21:23:49 +09:00

33 lines
938 B
Dart

import '../config/color_themes.dart';
/// Theme model that wraps ColorThemes with rotation and state management.
/// Holds all possible color palettes via delegation, exposing only the current set.
class ThemeModel {
final int _currentIndex;
const ThemeModel({int currentIndex = 0}) : _currentIndex = currentIndex;
/// Get the current active color theme
ColorTheme get current => ColorThemes.getTheme(_currentIndex);
/// Get the name of the current theme
String get currentSetName => current.name;
/// Get the current theme index
int get currentIndex => _currentIndex;
/// Rotate to the next theme (circular)
ThemeModel rotate() {
return ThemeModel(
currentIndex: ColorThemes.getNextThemeIndex(_currentIndex),
);
}
/// Create a copy with an updated theme index
ThemeModel copyWith({int? currentIndex}) {
return ThemeModel(
currentIndex: currentIndex ?? _currentIndex,
);
}
}