import 'package:flutter/material.dart';
import 'package:garage/auth/widget/auth_page.dart';
import 'package:garage/notification/page/notification_page.dart';
import 'package:garage/user/model/user_provider.dart';
import 'package:garage/utils/expiry_colors.dart';
import 'package:provider/provider.dart';

final navigatorKey = GlobalKey<NavigatorState>();

class AppRoot extends StatelessWidget {
  const AppRoot({super.key});

  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (_) => UserProvider(),
      child: MaterialApp(
          debugShowCheckedModeBanner: false,
          locale: const Locale('cs'),
          navigatorKey: navigatorKey,
          title: "Moje Garáž",
          theme: ThemeData(
            useMaterial3: true,
            colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
            extensions: const <ThemeExtension<dynamic>>[
              ExpiryColors(
                expired: Colors.red,
                monthLess: Colors.orange,
              ),
            ],
          ),
          routes: {
            "/notification_page": (context) => NotificationPage(),
          },
          home: AuthPage()),
    );
  }
}
