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
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user