updates
This commit is contained in:
parent
2ce32cac4e
commit
b6639fb1c9
26 changed files with 454 additions and 204 deletions
|
|
@ -10,6 +10,7 @@ import 'shell/app_shell.dart';
|
|||
import 'state/providers.dart';
|
||||
import 'theme/accent.dart';
|
||||
import 'theme/app_theme.dart';
|
||||
import 'theme/tokens.dart';
|
||||
import 'widgets/splash_screen.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
|
|
@ -38,12 +39,26 @@ class TimbreApp extends ConsumerWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
// The accent either tracks the album art (default) or is pinned to a
|
||||
// user-chosen static color. The theme rebuilds whenever it changes.
|
||||
final settings = ref.watch(settingsProvider);
|
||||
final accent = settings.useStaticAccent
|
||||
? settings.staticAccentColor
|
||||
: ref.watch(accentProvider);
|
||||
|
||||
// Point the token getters at the selected theme's palette before the theme
|
||||
// (and the widget tree) read them.
|
||||
final palette = settings.appTheme == AppTheme.lavender
|
||||
? TimbrePalette.lavender
|
||||
: TimbrePalette.dark;
|
||||
TimbreColors.applyPalette(palette);
|
||||
|
||||
// The accent either tracks the album art (default theme, dynamic mode) or
|
||||
// is pinned — to the user's static color, or to the theme's own accent when
|
||||
// the theme locks it (Lavender). The theme rebuilds whenever it changes.
|
||||
final Color accent;
|
||||
if (settings.appTheme == AppTheme.lavender) {
|
||||
accent = palette.accentDefault; // locked lavender primary
|
||||
} else if (settings.useStaticAccent) {
|
||||
accent = settings.staticAccentColor;
|
||||
} else {
|
||||
accent = ref.watch(accentProvider);
|
||||
}
|
||||
// Keep the accent synced with the remote track's art while acting as a
|
||||
// remote (bug #6). Alive as long as the app is.
|
||||
ref.watch(remoteAccentSyncProvider);
|
||||
|
|
@ -52,8 +67,11 @@ class TimbreApp extends ConsumerWidget {
|
|||
debugShowCheckedModeBanner: false,
|
||||
theme: buildTimbreTheme(accent),
|
||||
// AppShell mounts under the splash and boots behind it; the splash fades
|
||||
// out after a couple of seconds.
|
||||
home: const SplashGate(child: AppShell()),
|
||||
// out after a couple of seconds. Keying AppShell by the theme forces a
|
||||
// remount on theme switch so every widget re-reads the (now runtime)
|
||||
// TimbreColors getters; providers live above TimbreApp, so playback and
|
||||
// library state survive the remount.
|
||||
home: SplashGate(child: AppShell(key: ValueKey(settings.appTheme))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue