Files
minstrel/flutter_client/lib/app.dart
T
bvandeusen 56f0557d94 feat(flutter): MinstrelApp watches themeMode + offers darkTheme
MaterialApp now provides both light and dark themes plus a
themeMode bound to themeModeProvider. ThemeMode.system rebuilds
the tree automatically when the OS toggles brightness — no manual
listener needed.

While themeModeProvider is loading (storage read in flight), falls
back to AppThemeMode.system, which inherits the OS setting.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 15:47:41 -04:00

24 lines
668 B
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'shared/routing.dart';
import 'theme/theme_data.dart';
import 'theme/theme_mode_provider.dart';
class MinstrelApp extends ConsumerWidget {
const MinstrelApp({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final router = ref.watch(routerProvider);
final mode = ref.watch(themeModeProvider).value ?? AppThemeMode.system;
return MaterialApp.router(
title: 'Minstrel',
theme: buildLightTheme(),
darkTheme: buildDarkTheme(),
themeMode: mode.materialMode,
routerConfig: router,
);
}
}