odoo_loyalty_app/lib/theme/app_theme.dart

107 lines
4.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class AppTheme {
// Mapan Core Tokens
static const Color primary = Color(0xFFB20000);
static const Color primaryContainer = Color(0xFFE00101);
static const Color secondary = Color(0xFF825500);
static const Color secondaryContainer = Color(0xFFFEB23D);
static const Color onSecondaryContainer = Color(0xFF6E4700);
// Surface Hierarchy
static const Color surface = Color(0xFFFCF9F8);
static const Color surfaceContainer = Color(0xFFF0EDED);
static const Color surfaceContainerLow = Color(0xFFF6F3F2);
static const Color surfaceContainerHighest = Color(0xFFE5E2E1);
// Text & On-Colors
static const Color onSurface = Color(0xFF1C1B1B);
static const Color onSurfaceVariant = Color(0xFF5E3F3A);
static const Color onPrimary = Colors.white;
/// The Signature 135-degree CTA Gradient for main buttons.
static const LinearGradient primaryGradient = LinearGradient(
colors: [primary, primaryContainer],
begin: Alignment.topLeft,
end: Alignment.bottomRight, // Approximation of 135 degrees
);
static ThemeData get lightTheme {
final baseTheme = ThemeData.light();
return ThemeData(
useMaterial3: true,
scaffoldBackgroundColor: surface,
colorScheme: const ColorScheme.light(
primary: primary,
primaryContainer: primaryContainer,
secondary: secondary,
secondaryContainer: secondaryContainer,
onSecondaryContainer: onSecondaryContainer,
surface: surface,
onSurface: onSurface,
onSurfaceVariant: onSurfaceVariant,
onPrimary: onPrimary,
error: Color(0xFFBA1A1A),
),
textTheme: baseTheme.textTheme.copyWith(
displayLarge: GoogleFonts.plusJakartaSans(color: onSurface, fontWeight: FontWeight.bold, letterSpacing: -0.5),
displayMedium: GoogleFonts.plusJakartaSans(color: onSurface, fontWeight: FontWeight.bold),
displaySmall: GoogleFonts.plusJakartaSans(color: onSurface, fontWeight: FontWeight.bold),
headlineMedium: GoogleFonts.plusJakartaSans(color: onSurface, fontWeight: FontWeight.bold),
titleLarge: GoogleFonts.beVietnamPro(color: onSurface, fontWeight: FontWeight.w600),
titleMedium: GoogleFonts.beVietnamPro(color: onSurface, fontWeight: FontWeight.w600),
titleSmall: GoogleFonts.beVietnamPro(color: onSurface, fontWeight: FontWeight.w500),
bodyLarge: GoogleFonts.beVietnamPro(color: onSurfaceVariant),
bodyMedium: GoogleFonts.beVietnamPro(color: onSurfaceVariant),
bodySmall: GoogleFonts.beVietnamPro(color: onSurfaceVariant),
labelLarge: GoogleFonts.beVietnamPro(color: onSurfaceVariant),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
foregroundColor: onPrimary,
backgroundColor: primaryContainer, // Fallback if no gradient is used
elevation: 0,
),
),
cardTheme: CardThemeData(
color: surfaceContainerLow,
elevation: 0, // Depth created via tonal shifts
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
margin: EdgeInsets.zero,
),
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: surfaceContainerHighest,
// Using "Ghost Border" logic at 15% opacity
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: const BorderSide(color: Color(0x26946E68)),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: const BorderSide(color: Color(0x26946E68)),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(color: primary.withOpacity(0.4), width: 2),
),
labelStyle: const TextStyle(color: onSurfaceVariant),
),
appBarTheme: AppBarTheme(
backgroundColor: surface,
foregroundColor: onSurface,
elevation: 0,
surfaceTintColor: Colors.transparent,
titleTextStyle: GoogleFonts.plusJakartaSans(
color: onSurface,
fontSize: 20,
fontWeight: FontWeight.bold
),
),
);
}
}