import 'package:flutter/material.dart';

import '../application/app_bootstrap.dart';
import 'home_screen.dart';
import 'theme.dart';

final class GameTimeApp extends StatefulWidget {
  const GameTimeApp({required this.bootstrap, super.key});

  final AppBootstrap bootstrap;

  @override
  State<GameTimeApp> createState() => _GameTimeAppState();
}

final class _GameTimeAppState extends State<GameTimeApp> {
  var _themeMode = ThemeMode.system;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'GameTime',
      theme: courtBlazerLightTheme(),
      darkTheme: courtBlazerDarkTheme(),
      themeMode: _themeMode,
      navigatorObservers: [homeRouteObserver],
      home: HomeScreen(
        bootstrap: widget.bootstrap,
        themeMode: _themeMode,
        onThemeModeChanged: (mode) => setState(() => _themeMode = mode),
      ),
    );
  }
}
