import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'core/constants/colors.dart'; import 'features/auth/providers/auth_provider.dart'; import 'features/auth/screens/login_screen.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'features/home/screens/home_screen.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); final prefs = await SharedPreferences.getInstance(); final isLoggedIn = prefs.containsKey('token'); runApp( MultiProvider( providers: [ ChangeNotifierProvider(create: (_) => AuthProvider()), ], child: MyApp(isLoggedIn: isLoggedIn), ), ); } class MyApp extends StatelessWidget { final bool isLoggedIn; const MyApp({super.key, required this.isLoggedIn}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Social Buddy', debugShowCheckedModeBanner: false, theme: ThemeData( useMaterial3: true, scaffoldBackgroundColor: const Color(0xFFFAFAFA), colorScheme: ColorScheme.fromSeed( seedColor: AppColors.primary, primary: AppColors.primary, secondary: AppColors.secondary, error: AppColors.danger, ), textTheme: GoogleFonts.nunitoTextTheme( Theme.of(context).textTheme, ), appBarTheme: AppBarTheme( backgroundColor: Colors.white, elevation: 0, centerTitle: true, iconTheme: const IconThemeData(color: AppColors.black), titleTextStyle: GoogleFonts.nunito( color: AppColors.black, fontSize: 18, fontWeight: FontWeight.bold, ), ), elevatedButtonTheme: ElevatedButtonThemeData( style: ElevatedButton.styleFrom( backgroundColor: AppColors.primary, foregroundColor: Colors.white, padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), textStyle: GoogleFonts.nunito( fontWeight: FontWeight.bold, fontSize: 16, ), ), ), inputDecorationTheme: InputDecorationTheme( filled: true, fillColor: Colors.white, contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), border: OutlineInputBorder( borderRadius: BorderRadius.circular(12), borderSide: BorderSide(color: AppColors.whiteDark.withOpacity(0.2)), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(12), borderSide: BorderSide(color: AppColors.whiteDark.withOpacity(0.2)), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(12), borderSide: const BorderSide(color: AppColors.primary), ), hintStyle: GoogleFonts.nunito(color: AppColors.whiteDark), ), ), home: isLoggedIn ? const HomeScreen() : const LoginScreen(), ); } }