136 lines
5.3 KiB
Dart
136 lines
5.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'app_colors.dart';
|
|
|
|
/// Thème visuel de l'application Laverie.
|
|
class AppTheme {
|
|
AppTheme._();
|
|
|
|
static ThemeData get light {
|
|
const colorScheme = ColorScheme.light(
|
|
primary: AppColors.primary,
|
|
onPrimary: Colors.white,
|
|
primaryContainer: Color(0xFFDBEAFE),
|
|
onPrimaryContainer: AppColors.primaryDark,
|
|
secondary: AppColors.secondary,
|
|
onSecondary: Colors.white,
|
|
error: AppColors.error,
|
|
onError: Colors.white,
|
|
surface: AppColors.surface,
|
|
onSurface: AppColors.textPrimary,
|
|
onSurfaceVariant: AppColors.textSecondary,
|
|
);
|
|
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: colorScheme,
|
|
scaffoldBackgroundColor: AppColors.background,
|
|
appBarTheme: const AppBarTheme(
|
|
centerTitle: false,
|
|
elevation: 0,
|
|
scrolledUnderElevation: 0,
|
|
backgroundColor: AppColors.surface,
|
|
foregroundColor: AppColors.textPrimary,
|
|
surfaceTintColor: Colors.transparent,
|
|
systemOverlayStyle: SystemUiOverlayStyle.dark,
|
|
titleTextStyle: TextStyle(
|
|
color: AppColors.textPrimary,
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
cardTheme: CardThemeData(
|
|
elevation: 1,
|
|
shadowColor: Colors.black.withValues(alpha: 0.06),
|
|
color: AppColors.surface,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
|
margin: EdgeInsets.zero,
|
|
),
|
|
dividerTheme: const DividerThemeData(color: AppColors.divider, thickness: 1),
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
filled: true,
|
|
fillColor: AppColors.surface,
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
borderSide: BorderSide.none,
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
borderSide: const BorderSide(color: AppColors.divider),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
borderSide: const BorderSide(color: AppColors.primary, width: 1.5),
|
|
),
|
|
prefixIconColor: AppColors.textSecondary,
|
|
),
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
style: ElevatedButton.styleFrom(
|
|
minimumSize: const Size.fromHeight(48),
|
|
elevation: 0,
|
|
backgroundColor: AppColors.success,
|
|
foregroundColor: Colors.white,
|
|
disabledBackgroundColor: AppColors.success.withValues(alpha: 0.4),
|
|
disabledForegroundColor: Colors.white70,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
textStyle: const TextStyle(fontWeight: FontWeight.w600, fontSize: 16),
|
|
),
|
|
),
|
|
filledButtonTheme: FilledButtonThemeData(
|
|
style: FilledButton.styleFrom(
|
|
minimumSize: const Size.fromHeight(48),
|
|
backgroundColor: AppColors.success,
|
|
foregroundColor: Colors.white,
|
|
disabledBackgroundColor: AppColors.success.withValues(alpha: 0.5),
|
|
disabledForegroundColor: Colors.white.withValues(alpha: 0.8),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
textStyle: const TextStyle(fontWeight: FontWeight.w600, fontSize: 16),
|
|
),
|
|
),
|
|
outlinedButtonTheme: OutlinedButtonThemeData(
|
|
style: OutlinedButton.styleFrom(
|
|
minimumSize: const Size.fromHeight(48),
|
|
foregroundColor: AppColors.primary,
|
|
side: const BorderSide(color: AppColors.divider),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
),
|
|
),
|
|
floatingActionButtonTheme: const FloatingActionButtonThemeData(
|
|
elevation: 3,
|
|
backgroundColor: AppColors.primary,
|
|
foregroundColor: Colors.white,
|
|
),
|
|
navigationBarTheme: NavigationBarThemeData(
|
|
elevation: 0,
|
|
height: 64,
|
|
backgroundColor: AppColors.surface,
|
|
indicatorColor: AppColors.primary.withValues(alpha: 0.12),
|
|
surfaceTintColor: Colors.transparent,
|
|
labelTextStyle: WidgetStateProperty.resolveWith((states) {
|
|
if (states.contains(WidgetState.selected)) {
|
|
return const TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: AppColors.primary);
|
|
}
|
|
return const TextStyle(fontSize: 12, color: AppColors.textSecondary);
|
|
}),
|
|
iconTheme: WidgetStateProperty.resolveWith((states) {
|
|
if (states.contains(WidgetState.selected)) {
|
|
return const IconThemeData(color: AppColors.primary, size: 24);
|
|
}
|
|
return const IconThemeData(color: AppColors.textSecondary, size: 24);
|
|
}),
|
|
),
|
|
listTileTheme: const ListTileThemeData(
|
|
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
|
),
|
|
textTheme: const TextTheme(
|
|
headlineMedium: TextStyle(fontSize: 22, fontWeight: FontWeight.w600, color: AppColors.textPrimary),
|
|
titleMedium: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: AppColors.textPrimary),
|
|
bodyLarge: TextStyle(fontSize: 16, color: AppColors.textPrimary),
|
|
bodyMedium: TextStyle(fontSize: 14, color: AppColors.textSecondary),
|
|
),
|
|
);
|
|
}
|
|
}
|