Files
PeachDeployments/lib/Peach/configs/ThemeController.dart
alvocool 38881d1fe1 Add app source and tests
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-11 10:15:30 +03:00

24 lines
685 B
Dart

import 'package:flutter/material.dart';
/// App-wide theme mode. `main.dart` listens to this and rebuilds MaterialApp;
/// any screen can set it. Persisting the choice is the ViewModel's job — this
/// only carries the live value.
class ThemeController {
ThemeController._();
static final ValueNotifier<ThemeMode> mode = ValueNotifier<ThemeMode>(
ThemeMode.dark,
);
/// The stored string ('dark' | 'light' | 'system') for the current mode.
static String get name => mode.value.name;
static void apply(String stored) {
mode.value = switch (stored) {
'light' => ThemeMode.light,
'system' => ThemeMode.system,
_ => ThemeMode.dark,
};
}
}