185 lines
7.3 KiB
Dart
185 lines
7.3 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 tertiary = Color(0xFF4A7C59); // Warm Sage/Forest Green
|
|
static const Color tertiaryContainer = Color(0xFFCCE8D6); // Soft sage tint
|
|
static const Color onPrimaryContainer = Colors.white;
|
|
static const Color onSecondaryContainer = Color(0xFF5A3E00);
|
|
static const Color onTertiary = Colors.white;
|
|
static const Color onTertiaryContainer = Color(0xFF0D3320); // Deep forest text
|
|
|
|
// 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? tertiaryColor, Color? backgroundColor}) {
|
|
final baseTheme = ThemeData.light();
|
|
final pColor = primaryColor ?? primary;
|
|
final sColor = secondaryColor ?? secondary;
|
|
final tColor = tertiaryColor ?? tertiary;
|
|
final bg = backgroundColor ?? surface;
|
|
|
|
// Dynamically compute readable contrast text colors
|
|
final onPrimaryColor = pColor.computeLuminance() > 0.5 ? const Color(0xFF2E251B) : Colors.white;
|
|
final onSecondaryColor = sColor.computeLuminance() > 0.5 ? const Color(0xFF2E251B) : Colors.white;
|
|
final onTertiaryColor = tColor.computeLuminance() > 0.5 ? const Color(0xFF2E251B) : Colors.white;
|
|
// Tertiary container: a desaturated/lightened tint of the tertiary color
|
|
final tContainerColor = Color.lerp(tColor, Colors.white, 0.75) ?? tertiaryContainer;
|
|
final onTertiaryContainerColor = tColor.computeLuminance() > 0.5
|
|
? const Color(0xFF2E251B)
|
|
: Color.lerp(tColor, Colors.black, 0.7) ?? onTertiaryContainer;
|
|
|
|
final isWhiteBg = bg.r > 0.98 && bg.g > 0.98 && bg.b > 0.98;
|
|
final lowestColor = isWhiteBg ? const Color(0xFFFCFAF7) : const Color(0xFFFCFAF6);
|
|
final lowColor = isWhiteBg ? const Color(0xFFF5F3ED) : const Color(0xFFF7F1E3);
|
|
final containerColor = isWhiteBg ? const Color(0xFFEDEAE1) : const Color(0xFFF2EAD8);
|
|
final highColor = isWhiteBg ? const Color(0xFFE2DDD2) : const Color(0xFFE5D5BA);
|
|
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
scaffoldBackgroundColor: bg,
|
|
colorScheme: ColorScheme.light(
|
|
primary: pColor,
|
|
primaryContainer: pColor,
|
|
onPrimary: onPrimaryColor,
|
|
secondary: sColor,
|
|
secondaryContainer: sColor.withValues(alpha: 0.15),
|
|
onSecondary: onSecondaryColor,
|
|
onSecondaryContainer: onSecondaryColor,
|
|
tertiary: tColor,
|
|
tertiaryContainer: tContainerColor,
|
|
onTertiary: onTertiaryColor,
|
|
onTertiaryContainer: onTertiaryContainerColor,
|
|
surface: bg,
|
|
surfaceContainerLowest: lowestColor,
|
|
surfaceContainerLow: lowColor,
|
|
surfaceContainer: containerColor,
|
|
surfaceContainerHigh: highColor,
|
|
onSurface: onSurface,
|
|
onSurfaceVariant: onSurfaceVariant,
|
|
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,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|