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'; void main() { runApp( MultiProvider( providers: [ ChangeNotifierProvider( create: (context) => LocaleProvider(), ), ChangeNotifierProvider( create: (context) => ThemeProvider(), ), ], 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 Consumer2( builder: (context, localeProvider, themeProvider, child) { 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.white, colorScheme: ColorScheme.light( primary: Colors.blue.shade600, secondary: Colors.teal.shade400, surface: Colors.white, background: Colors.white, error: Colors.red.shade700, onPrimary: Colors.white, onSecondary: Colors.white, onSurface: Colors.black87, onBackground: Colors.black87, ), scaffoldBackgroundColor: Colors.white, appBarTheme: AppBarTheme( backgroundColor: Colors.white, foregroundColor: Colors.black87, elevation: 0.5, iconTheme: const IconThemeData(color: Colors.black87), titleTextStyle: const TextStyle( color: Colors.black87, fontSize: 20, fontWeight: FontWeight.bold, ), ), floatingActionButtonTheme: FloatingActionButtonThemeData( backgroundColor: Colors.blue.shade600, 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: Colors.blue.shade50, ), 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, buttonTheme: ButtonThemeData( buttonColor: Colors.blue.shade600, textTheme: ButtonTextTheme.primary, 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: Colors.blue.shade600, 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.lightBlueAccent, 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: Colors.lightBlueAccent, 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: Colors.blueGrey[700], ), 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, buttonTheme: ButtonThemeData( buttonColor: Colors.lightBlueAccent, textTheme: ButtonTextTheme.primary, 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: Colors.lightBlueAccent, 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(), ); }, ); } }