import 'package:absensi_sas/app/constant.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../app/route.dart';
import 'package:intl/date_symbol_data_local.dart';
// import '../test_map.dart';

// final routerProvider = Provider((_) => GlobalKey<NavigatorState>());

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  initializeDateFormatting();
  await SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
  ]);
  SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
    statusBarIconBrightness:
        Brightness.dark, // this will change the brightness of the icons
    statusBarColor: Colors.white, // or any color you want
  ));
  runApp(
    ProviderScope(
      // overrides: [
      //   routerProvider.overrideWithValue(GlobalKey<NavigatorState>()),
      // ],
      child: MyApp(),
    ),
  );
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Absensi SAS',
      // theme: ThemeData(
      // colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      // useMaterial3: true,
      // ),
      theme: ThemeData(
        primarySwatch: Colors.orange,
        primaryColor: Constant.textOrange,
        primaryColorDark: Constant.textOrange,
        primaryColorLight: Constant.textOrange,
        colorScheme: Theme.of(context).colorScheme.copyWith(
            primary: Constant.textOrange,
            background: Colors.white,
            surface: Colors.white),
        // datePickerTheme: DatePickerThemeData(
        //     // backgroundColor: Colors.white,
        //     // headerHeadlineStyle:
        //     //     Constant.h3_400(context: context).copyWith(color: Colors.white),
        //     headerBackgroundColor: Constant.textOrange,
        //     headerForegroundColor: Colors.white,
        //     surfaceTintColor: Colors.white,
        //     backgroundColor: Colors.white),
      ),

      // home: TestMap(),
      initialRoute: loginRoute,
      // initialRoute: presensiSelfieRoute,
      // initialRoute: testFlutterMapRoute,
      onGenerateRoute: AppRoute.generateRoute,
    );
  }
}
