24 lines
939 B
Dart
24 lines
939 B
Dart
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'tokens.dart';
|
|
|
|
/// Holds the current accent color — the "hero" of Timbre's aesthetic.
|
|
///
|
|
/// In the `dynamic` theme this is extracted from the playing track's album
|
|
/// art and boosted for readability in OKLab space (Timbre `color.rs:11-64`),
|
|
/// then interpolated toward over ~400ms. Phase 1 just exposes the default and
|
|
/// a setter; the extraction + animation land in Phase 2 with playback.
|
|
class AccentNotifier extends StateNotifier<Color> {
|
|
AccentNotifier() : super(TimbreColors.accentDefault);
|
|
|
|
/// Snap to a new accent (e.g. from album-art extraction).
|
|
void set(Color color) => state = color;
|
|
|
|
/// Return to the fixed default (e.g. no art / `static` theme).
|
|
void reset() => state = TimbreColors.accentDefault;
|
|
}
|
|
|
|
final accentProvider = StateNotifierProvider<AccentNotifier, Color>(
|
|
(ref) => AccentNotifier(),
|
|
);
|