import 'package:shared_preferences/shared_preferences.dart'; import '../constants.dart'; import '../services/auth/auth_gate.dart'; import '../themes/theme_provider.dart'; import 'package:flutter/material.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:provider/provider.dart'; import 'firebase_options.dart'; import 'pages/conversations_page.dart'; import 'pages/liked_users_page.dart'; import 'pages/user_matching_page.dart'; import 'pages/user_profile_page.dart'; void main() async { // Firebase stuff WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); // Init SharedPreferences final prefs = await SharedPreferences.getInstance(); final isDarkMode = prefs.getBool(Constants.prefKeyThemeDarkMode) ?? false; runApp( ChangeNotifierProvider( create: (context) => ThemeProvider(initialIsDarkMode: isDarkMode), child: const MyApp(), ), ); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: Constants.appTitle, theme: Provider.of(context).themeData, home: const AuthGate(), routes: { '/discover': (context) => const UserMatchingPage(), '/favorites': (context) => const LikedUsersPage(), '/chats': (context) => ConversationsPage(), '/profile': (context) => const UserProfilePage(), }, ); } }