import 'package:flutter/material.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; import 'screens/welcome_screen.dart'; import 'screens/booking_screen.dart'; import 'screens/login_screen.dart'; import 'screens/register_screen.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); await Supabase.initialize( url: 'https://sbwxwqbjgwjecedsfslk.supabase.co', anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNid3h3cWJqZ3dqZWNlZHNmc2xrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDExMDA3NjEsImV4cCI6MjA1NjY3Njc2MX0.TZRiNBGpGkPLRLBQjmeoNpFmXtJaWMMJvP0jFWWILQ4', ); runApp(const MyApp()); } // ── Global Color Palette ────────────────────────────── const kWhite = Color(0xFFFFFFFF); const kSurface = Color(0xFFE5E7EB); const kSectionBg = Color(0xFFF9FAFB); const kAccent = Color(0xFF0EA5E9); const kAccentHover = Color(0xFF0284C7); const kTextPrimary = Color(0xFF111827); const kTextSecondary = Color(0xFF6B7280); const kBorder = Color(0xFFE5E7EB); // ───────────────────────────────────────────────────── class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Jaanji', debugShowCheckedModeBanner: false, theme: ThemeData( useMaterial3: true, colorScheme: const ColorScheme.light( primary: kAccent, secondary: kAccentHover, surface: kWhite, onPrimary: kWhite, onSecondary: kWhite, onSurface: kTextPrimary, outline: kBorder, ), scaffoldBackgroundColor: kWhite, appBarTheme: const AppBarTheme( backgroundColor: kWhite, foregroundColor: kTextPrimary, elevation: 0, scrolledUnderElevation: 0, iconTheme: IconThemeData(color: kTextPrimary), titleTextStyle: TextStyle( color: kTextPrimary, fontSize: 18, fontWeight: FontWeight.w600, ), shape: Border( bottom: BorderSide(color: kBorder, width: 1), ), ), cardTheme: CardThemeData( color: kWhite, elevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(12)), side: BorderSide(color: kBorder), ), ), elevatedButtonTheme: ElevatedButtonThemeData( style: ElevatedButton.styleFrom( backgroundColor: kAccent, foregroundColor: kWhite, disabledBackgroundColor: kSurface, disabledForegroundColor: kTextSecondary, elevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8)), textStyle: const TextStyle( fontWeight: FontWeight.w600, fontSize: 14), ), ), outlinedButtonTheme: OutlinedButtonThemeData( style: OutlinedButton.styleFrom( foregroundColor: kAccent, side: const BorderSide(color: kBorder), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8)), textStyle: const TextStyle( fontWeight: FontWeight.w600, fontSize: 14), ), ), textButtonTheme: TextButtonThemeData( style: TextButton.styleFrom( foregroundColor: kAccent, textStyle: const TextStyle( fontWeight: FontWeight.w600, fontSize: 14), ), ), inputDecorationTheme: InputDecorationTheme( filled: true, fillColor: kWhite, contentPadding: const EdgeInsets.symmetric( horizontal: 16, vertical: 12), border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), borderSide: const BorderSide(color: kBorder), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8), borderSide: const BorderSide(color: kBorder), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8), borderSide: const BorderSide(color: kAccent, width: 2), ), labelStyle: const TextStyle( color: kTextSecondary, fontSize: 14), hintStyle: const TextStyle( color: kTextSecondary, fontSize: 14), prefixIconColor: kTextSecondary, ), floatingActionButtonTheme: const FloatingActionButtonThemeData( backgroundColor: kAccent, foregroundColor: kWhite, elevation: 0, ), dividerTheme: const DividerThemeData( color: kBorder, thickness: 1, space: 1, ), listTileTheme: const ListTileThemeData( iconColor: kTextSecondary, titleTextStyle: TextStyle( color: kTextPrimary, fontWeight: FontWeight.w600, fontSize: 14), subtitleTextStyle: TextStyle(color: kTextSecondary, fontSize: 13), ), chipTheme: ChipThemeData( backgroundColor: kSurface, selectedColor: kAccent, labelStyle: const TextStyle( color: kTextPrimary, fontSize: 13), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), side: const BorderSide(color: kBorder), ), ), textTheme: const TextTheme( headlineLarge: TextStyle( color: kTextPrimary, fontWeight: FontWeight.w700, fontSize: 28), headlineMedium: TextStyle( color: kTextPrimary, fontWeight: FontWeight.w700, fontSize: 22), headlineSmall: TextStyle( color: kTextPrimary, fontWeight: FontWeight.w600, fontSize: 18), titleLarge: TextStyle( color: kTextPrimary, fontWeight: FontWeight.w600, fontSize: 16), titleMedium: TextStyle( color: kTextPrimary, fontWeight: FontWeight.w500, fontSize: 14), bodyLarge: TextStyle(color: kTextPrimary, fontSize: 15), bodyMedium: TextStyle( color: kTextSecondary, fontSize: 14), bodySmall: TextStyle( color: kTextSecondary, fontSize: 12), labelLarge: TextStyle( color: kWhite, fontWeight: FontWeight.w600, fontSize: 14), ), ), initialRoute: '/', onGenerateRoute: (settings) { final uri = Uri.parse(settings.name ?? '/'); // /book/slug → BookingScreen if (uri.pathSegments.length == 2 && uri.pathSegments[0] == 'book') { return MaterialPageRoute( builder: (_) => BookingScreen(slug: uri.pathSegments[1])); } // /login → LoginScreen if (uri.pathSegments.length == 1 && uri.pathSegments[0] == 'login') { return MaterialPageRoute( builder: (_) => const LoginScreen()); } // /register → RegisterScreen if (uri.pathSegments.length == 1 && uri.pathSegments[0] == 'register') { return MaterialPageRoute( builder: (_) => const RegisterScreen()); } // / → WelcomeScreen return MaterialPageRoute( builder: (_) => const WelcomeScreen()); }, ); } }