import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:provider/provider.dart'; import 'package:rtime/l10n/app_localizations.dart'; import 'package:rtime/pages/home_page.dart'; import 'package:rtime/providers/local_provider.dart'; import 'package:rtime/providers/theme_provider.dart'; import 'package:rtime/providers/color_provider.dart'; void main() { runApp( MultiProvider( providers: [ ChangeNotifierProvider( create: (context) => LocaleProvider(), ), ChangeNotifierProvider( create: (context) => ThemeProvider(), ), ChangeNotifierProvider( create: (context) => ColorProvider(), ), ], child: const MyApp(), ), ); } class MyApp extends StatefulWidget { const MyApp({super.key}); @override State createState() => _MyAppState(); } class _MyAppState extends State { @override Widget build(BuildContext context) { return Consumer3( builder: (context, localeProvider, themeProvider, colorProvider, child) { final customAccentColor = colorProvider.accentColor; return MaterialApp( title: 'Rtime', locale: localeProvider.locale, localizationsDelegates: const [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: const [ Locale('en', ''), Locale('fr', ''), ], theme: ThemeData( primaryColor: Colors.yellow[700], colorScheme: ColorScheme.light( primary: Colors.yellow[700]!, secondary: Colors.teal.shade400, surface: Colors.white, background: Colors.white, error: Colors.red.shade700, onPrimary: Colors.black87, onSecondary: Colors.white, onSurface: Colors.black87, onBackground: Colors.black87, ), scaffoldBackgroundColor: Colors.white, appBarTheme: AppBarTheme( backgroundColor: Colors.yellow[700], foregroundColor: Colors.black87, elevation: 0.5, iconTheme: const IconThemeData(color: Colors.black87), titleTextStyle: const TextStyle( color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold, ), ), floatingActionButtonTheme: FloatingActionButtonThemeData( backgroundColor: customAccentColor, foregroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30.0), ), extendedSizeConstraints: const BoxConstraints.tightFor( height: 70.0, width: 250.0, ), ), cardTheme: CardThemeData( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), elevation: 2, color: Colors.white, margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), ), listTileTheme: ListTileThemeData( contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), tileColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), selectedTileColor: customAccentColor.withOpacity(0.1), ), textTheme: const TextTheme( headlineSmall: TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.black87), titleMedium: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.black87), titleSmall: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.black54), bodyLarge: TextStyle(color: Colors.black87), bodyMedium: TextStyle(color: Colors.black54), bodySmall: TextStyle(fontSize: 12, color: Colors.black45), ), visualDensity: VisualDensity.adaptivePlatformDensity, elevatedButtonTheme: ElevatedButtonThemeData( style: ElevatedButton.styleFrom( backgroundColor: customAccentColor, foregroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), ), ), textButtonTheme: TextButtonThemeData( style: TextButton.styleFrom( foregroundColor: customAccentColor, ), ), outlinedButtonTheme: OutlinedButtonThemeData( style: OutlinedButton.styleFrom( side: BorderSide(color: customAccentColor), foregroundColor: customAccentColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), ), ), inputDecorationTheme: InputDecorationTheme( border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: Colors.grey.shade400), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: customAccentColor, width: 2), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: Colors.grey.shade300), ), labelStyle: const TextStyle(color: Colors.black54), hintStyle: TextStyle(color: Colors.grey.shade500), ), ), darkTheme: ThemeData.dark().copyWith( primaryColor: Colors.blueGrey[900], colorScheme: ColorScheme.dark( primary: Colors.blueGrey[600]!, secondary: Colors.tealAccent, surface: Colors.blueGrey.shade800, background: Colors.blueGrey.shade900, onPrimary: Colors.black, onSecondary: Colors.black, onSurface: Colors.white, onBackground: Colors.white, ), appBarTheme: AppBarTheme( backgroundColor: Colors.blueGrey[900], foregroundColor: Colors.white, elevation: 4, iconTheme: const IconThemeData(color: Colors.white), titleTextStyle: const TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold, ), ), floatingActionButtonTheme: FloatingActionButtonThemeData( backgroundColor: customAccentColor, foregroundColor: Colors.black, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30.0), ), extendedSizeConstraints: const BoxConstraints.tightFor( height: 70.0, width: 250.0, ), ), cardTheme: CardThemeData( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), elevation: 8, color: Colors.blueGrey[800], margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), ), listTileTheme: ListTileThemeData( contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), tileColor: Colors.blueGrey[800], shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), selectedTileColor: customAccentColor.withOpacity(0.3), ), textTheme: const TextTheme( headlineSmall: TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white), titleMedium: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white), titleSmall: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), bodyLarge: TextStyle(color: Colors.white70), bodyMedium: TextStyle(color: Colors.white60), bodySmall: TextStyle(fontSize: 12, color: Colors.white70), ), visualDensity: VisualDensity.adaptivePlatformDensity, elevatedButtonTheme: ElevatedButtonThemeData( style: ElevatedButton.styleFrom( backgroundColor: customAccentColor, foregroundColor: Colors.black, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), ), ), textButtonTheme: TextButtonThemeData( style: TextButton.styleFrom( foregroundColor: customAccentColor, ), ), outlinedButtonTheme: OutlinedButtonThemeData( style: OutlinedButton.styleFrom( side: BorderSide(color: customAccentColor), foregroundColor: customAccentColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), ), ), inputDecorationTheme: InputDecorationTheme( border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: Colors.blueGrey.shade600), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: customAccentColor, width: 2), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: Colors.blueGrey.shade700), ), labelStyle: const TextStyle(color: Colors.white70), hintStyle: TextStyle(color: Colors.blueGrey.shade500), ), ), themeMode: themeProvider.themeMode, home: const HomePage(), ); }, ); } }