odoo_loyalty_app/lib/theme/app_theme.dart

159 lines
5.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class AppTheme {
// Warm Traditional Family Restaurant Brand Colors
static const Color primary = Color(0xFF8A1C14); // Rich Brick/Crimson Red
static const Color primaryContainer = Color(0xFF8A1C14);
static const Color secondary = Color(0xFFB58428); // Warm Gold/Honey Amber
static const Color secondaryContainer = Color(0xFFF3DCA2);
static const Color onPrimaryContainer = Colors.white;
static const Color onSecondaryContainer = Color(0xFF5A3E00);
// Warm Ivory & Earthy Surface Hierarchy
static const Color surface = Color(0xFFFAF6EE); // Warm paper ivory background
static const Color surfaceContainer = Color(0xFFF2EAD8); // Soft cream
static const Color surfaceContainerLow = Color(0xFFF7F1E3); // Milky cream
static const Color surfaceContainerLowest = Color(0xFFFCFAF6); // Softest ivory/white
static const Color surfaceContainerHighest = Color(0xFFE5D5BA); // Warm toasted sand
// Text & On-Colors
static const Color onSurface = Color(0xFF2E251B); // Earthy dark brown instead of charcoal
static const Color onSurfaceVariant = Color(0xFF635647); // Subdued warm wood tone
static const Color onPrimary = Colors.white;
static const Color outlineVariant = Color(0xFFD3C5B1); // Soft sandy divider
static ThemeData get lightTheme => getTheme();
static ThemeData getTheme({Color? primaryColor, Color? secondaryColor, Color? backgroundColor}) {
final baseTheme = ThemeData.light();
final pColor = primaryColor ?? primary;
final sColor = secondaryColor ?? secondary;
final bg = backgroundColor ?? surface;
// Dynamically compute readable contrast text colors
final onPrimaryColor = pColor.computeLuminance() > 0.5 ? Color(0xFF2E251B) : Colors.white;
final onSecondaryColor = sColor.computeLuminance() > 0.5 ? Color(0xFF2E251B) : Colors.white;
return ThemeData(
useMaterial3: true,
scaffoldBackgroundColor: bg,
colorScheme: ColorScheme.light(
primary: pColor,
primaryContainer: pColor,
secondary: sColor,
secondaryContainer: sColor.withValues(alpha: 0.15),
onSecondaryContainer: onSecondaryColor,
surface: bg,
onSurface: onSurface,
onSurfaceVariant: onSurfaceVariant,
onPrimary: onPrimaryColor,
error: const Color(0xFFB02500),
),
textTheme: baseTheme.textTheme.copyWith(
displayLarge: GoogleFonts.lora(
color: onSurface,
fontWeight: FontWeight.bold,
letterSpacing: -0.01,
),
displayMedium: GoogleFonts.lora(
color: onSurface,
fontWeight: FontWeight.bold,
letterSpacing: -0.01,
),
displaySmall: GoogleFonts.lora(
color: onSurface,
fontWeight: FontWeight.bold,
letterSpacing: -0.01,
),
headlineMedium: GoogleFonts.lora(
color: onSurface,
fontWeight: FontWeight.bold,
letterSpacing: -0.01,
),
titleLarge: GoogleFonts.lora(
color: onSurface,
fontWeight: FontWeight.bold,
),
titleMedium: GoogleFonts.lora(
color: onSurface,
fontWeight: FontWeight.bold,
),
titleSmall: GoogleFonts.lora(
color: onSurface,
fontWeight: FontWeight.w600,
),
bodyLarge: GoogleFonts.manrope(
color: onSurface,
letterSpacing: 0.1,
),
bodyMedium: GoogleFonts.manrope(
color: onSurfaceVariant,
letterSpacing: 0.1,
),
bodySmall: GoogleFonts.manrope(
color: onSurfaceVariant,
letterSpacing: 0.1,
),
labelLarge: GoogleFonts.manrope(
color: onSurfaceVariant,
fontWeight: FontWeight.w600,
),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(28), // Elegant pill buttons
),
foregroundColor: onPrimaryColor,
backgroundColor: pColor,
elevation: 2,
shadowColor: pColor.withValues(alpha: 0.2),
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
),
),
cardTheme: CardThemeData(
color: surfaceContainerLow,
elevation: 1,
shadowColor: Colors.black.withValues(alpha: 0.05),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16), // Softer warm card corners
),
margin: EdgeInsets.zero,
),
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: surfaceContainer,
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(12),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(12),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: pColor.withValues(alpha: 0.5), width: 1.5),
borderRadius: BorderRadius.circular(12),
),
labelStyle: const TextStyle(color: onSurfaceVariant),
hintStyle: GoogleFonts.manrope(color: onSurfaceVariant),
),
appBarTheme: AppBarTheme(
backgroundColor: surface,
foregroundColor: onSurface,
elevation: 0,
surfaceTintColor: Colors.transparent,
centerTitle: true,
titleTextStyle: GoogleFonts.lora(
color: onSurface,
fontSize: 21,
fontWeight: FontWeight.bold,
letterSpacing: -0.01,
),
),
);
}
}