Add main color

This commit is contained in:
2025-07-09 20:16:04 +02:00
parent 51cc737ad8
commit e1684285a2
20 changed files with 608 additions and 460 deletions

View File

@ -5,6 +5,7 @@ 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(
@ -16,6 +17,9 @@ void main() {
ChangeNotifierProvider(
create: (context) => ThemeProvider(),
),
ChangeNotifierProvider(
create: (context) => ColorProvider(),
),
],
child: const MyApp(),
),
@ -32,8 +36,11 @@ class MyApp extends StatefulWidget {
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return Consumer2<LocaleProvider, ThemeProvider>(
builder: (context, localeProvider, themeProvider, child) {
return Consumer3<LocaleProvider, ThemeProvider, ColorProvider>(
builder: (context, localeProvider, themeProvider, colorProvider, child) {
// customAccentColor est toujours là si tu veux l'utiliser pour d'autres éléments
final customAccentColor = colorProvider.accentColor;
return MaterialApp(
title: 'Rtime',
locale: localeProvider.locale,
@ -47,11 +54,10 @@ class _MyAppState extends State<MyApp> {
Locale('en', ''),
Locale('fr', ''),
],
theme: ThemeData(
primaryColor: Colors.white,
colorScheme: ColorScheme.light(
primary: Colors.blue.shade600,
primary: Colors.blue, // Couleur primaire fixe pour le mode clair
secondary: Colors.teal.shade400,
surface: Colors.white,
background: Colors.white,
@ -62,20 +68,19 @@ class _MyAppState extends State<MyApp> {
onBackground: Colors.black87,
),
scaffoldBackgroundColor: Colors.white,
appBarTheme: AppBarTheme(
backgroundColor: Colors.white,
appBarTheme: const AppBarTheme(
backgroundColor: Color(0xFFF5F5F5),
foregroundColor: Colors.black87,
elevation: 0.5,
iconTheme: const IconThemeData(color: Colors.black87),
titleTextStyle: const TextStyle(
color: Colors.black87,
iconTheme: IconThemeData(color: Colors.black87),
titleTextStyle: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: Colors.blue.shade600,
backgroundColor: customAccentColor,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
@ -99,7 +104,7 @@ class _MyAppState extends State<MyApp> {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
selectedTileColor: Colors.blue.shade50,
selectedTileColor: customAccentColor.withOpacity(0.1),
),
textTheme: const TextTheme(
headlineSmall: TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.black87),
@ -110,11 +115,27 @@ class _MyAppState extends State<MyApp> {
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),
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(
@ -124,7 +145,7 @@ class _MyAppState extends State<MyApp> {
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(color: Colors.blue.shade600, width: 2),
borderSide: BorderSide(color: customAccentColor, width: 2),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
@ -134,12 +155,10 @@ class _MyAppState extends State<MyApp> {
hintStyle: TextStyle(color: Colors.grey.shade500),
),
),
darkTheme: ThemeData.dark().copyWith(
primaryColor: Colors.blueGrey[900],
colorScheme: ColorScheme.dark(
primary: Colors.lightBlueAccent,
primary: Colors.blueGrey[600]!,
secondary: Colors.tealAccent,
surface: Colors.blueGrey.shade800,
background: Colors.blueGrey.shade900,
@ -148,9 +167,6 @@ class _MyAppState extends State<MyApp> {
onSurface: Colors.white,
onBackground: Colors.white,
),
appBarTheme: AppBarTheme(
backgroundColor: Colors.blueGrey[900],
foregroundColor: Colors.white,
@ -163,7 +179,7 @@ class _MyAppState extends State<MyApp> {
),
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: Colors.lightBlueAccent,
backgroundColor: customAccentColor,
foregroundColor: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
@ -185,7 +201,7 @@ class _MyAppState extends State<MyApp> {
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
tileColor: Colors.blueGrey[800],
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
selectedTileColor: Colors.blueGrey[700],
selectedTileColor: customAccentColor.withOpacity(0.3),
),
textTheme: const TextTheme(
headlineSmall: TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white),
@ -196,11 +212,27 @@ class _MyAppState extends State<MyApp> {
bodySmall: TextStyle(fontSize: 12, color: Colors.white70),
),
visualDensity: VisualDensity.adaptivePlatformDensity,
buttonTheme: ButtonThemeData(
buttonColor: Colors.lightBlueAccent,
textTheme: ButtonTextTheme.primary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
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(
@ -210,7 +242,7 @@ class _MyAppState extends State<MyApp> {
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(color: Colors.lightBlueAccent, width: 2),
borderSide: BorderSide(color: customAccentColor, width: 2),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),