import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:pmsna1/providers/flags_provider.dart'; import 'package:pmsna1/providers/theme_provider.dart'; import 'package:pmsna1/routes.dart'; import 'package:pmsna1/settings/themes.dart'; import 'package:provider/provider.dart'; void main(List args) async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); return runApp(const MainContent()); } class MainContent extends StatefulWidget { const MainContent({super.key}); @override State createState() => _MainContentState(); } class _MainContentState extends State { int contador = 0; @override void initState() { super.initState(); contador = 0; } @override Widget build(BuildContext context) { return MultiProvider( providers: [ ChangeNotifierProvider(create: (_) => ThemeProvider()), ChangeNotifierProvider(create: (_) => FlagsProvider()), ], child: const PMSNA1(), ); } } class PMSNA1 extends StatelessWidget { const PMSNA1({super.key}); @override Widget build(BuildContext context) { final ThemeProvider provider = context.watch(); final ThemeData? theme = provider.theme; provider.syncFromPrefs(); return MaterialApp( theme: theme ?? ThemeSettings.lightTheme, darkTheme: theme ?? ThemeSettings.darkTheme, themeMode: ThemeMode.system, routes: getApplicationRoutes(), initialRoute: '/login', ); } }