5122be4bc1
- 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
33 lines
938 B
Dart
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,
|
|
);
|
|
}
|
|
}
|