91 lines
3.6 KiB
Dart
91 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
class AppTheme {
|
|
static const Color posimaiBlue = Color(0xFF376495);
|
|
|
|
// Padding Constants
|
|
static const double spacingEmpty = 0.0;
|
|
static const double spacingTiny = 4.0;
|
|
static const double spacingSmall = 8.0;
|
|
static const double spacingMedium = 16.0;
|
|
static const double spacingLarge = 24.0;
|
|
static const double spacingXLarge = 32.0;
|
|
|
|
|
|
static ThemeData createTheme(String fontPreference, Brightness brightness) {
|
|
final textTheme = (fontPreference == 'serif')
|
|
? GoogleFonts.notoSerifJpTextTheme()
|
|
: GoogleFonts.notoSansJpTextTheme();
|
|
|
|
final baseColorScheme = ColorScheme.fromSeed(
|
|
seedColor: posimaiBlue,
|
|
brightness: brightness,
|
|
);
|
|
|
|
// Dark Mode Refinements for Posimai Blue
|
|
final colorScheme = (brightness == Brightness.dark)
|
|
? baseColorScheme.copyWith(
|
|
primary: const Color(0xFF8AB4F8), // Lighter blue for dark mode visibility
|
|
onPrimary: Colors.black,
|
|
surface: const Color(0xFF1E1E1E),
|
|
)
|
|
: baseColorScheme;
|
|
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: colorScheme,
|
|
textTheme: textTheme.apply(
|
|
bodyColor: (brightness == Brightness.dark) ? Colors.white : Colors.black87,
|
|
displayColor: (brightness == Brightness.dark) ? Colors.white : Colors.black87,
|
|
).copyWith(
|
|
// Ensure headers/labels are visible
|
|
titleMedium: TextStyle(color: (brightness == Brightness.dark) ? Colors.white : Colors.black87),
|
|
titleSmall: TextStyle(color: (brightness == Brightness.dark) ? Colors.white70 : Colors.black54),
|
|
labelLarge: TextStyle(color: (brightness == Brightness.dark) ? Colors.white : Colors.black87),
|
|
),
|
|
scaffoldBackgroundColor: (brightness == Brightness.dark)
|
|
? const Color(0xFF121212)
|
|
: Colors.white,
|
|
|
|
cardTheme: CardThemeData(
|
|
elevation: 0,
|
|
margin: EdgeInsets.zero,
|
|
color: (brightness == Brightness.dark) ? const Color(0xFF1E1E1E) : Colors.white,
|
|
),
|
|
|
|
appBarTheme: AppBarTheme(
|
|
backgroundColor: (brightness == Brightness.dark) ? const Color(0xFF121212) : null,
|
|
foregroundColor: (brightness == Brightness.dark) ? Colors.white : Colors.black87,
|
|
actionsIconTheme: IconThemeData(
|
|
color: (brightness == Brightness.dark) ? Colors.white : Colors.black87,
|
|
),
|
|
iconTheme: IconThemeData(
|
|
color: (brightness == Brightness.dark) ? Colors.white : Colors.black87,
|
|
),
|
|
),
|
|
|
|
iconTheme: IconThemeData(
|
|
color: (brightness == Brightness.dark) ? Colors.white : const Color(0xFF376495),
|
|
),
|
|
|
|
/*
|
|
dialogTheme: DialogTheme(
|
|
backgroundColor: (brightness == Brightness.dark) ? const Color(0xFF2C2C2C) : Colors.white,
|
|
titleTextStyle: TextStyle(color: (brightness == Brightness.dark) ? Colors.white : Colors.black, fontSize: 20, fontWeight: FontWeight.bold),
|
|
contentTextStyle: TextStyle(color: (brightness == Brightness.dark) ? Colors.white : Colors.black, fontSize: 16),
|
|
),
|
|
*/
|
|
|
|
navigationBarTheme: NavigationBarThemeData(
|
|
backgroundColor: (brightness == Brightness.dark) ? const Color(0xFF1E1E1E) : null,
|
|
indicatorColor: (brightness == Brightness.dark)
|
|
? const Color(0xFF376495)
|
|
: const Color(0xFF376495).withValues(alpha: 0.25),
|
|
// Removed custom MaterialStateProperty text styles to avoid potential type issues for now.
|
|
// Default text style usually adapts to brightness if colorScheme.onSurface/onPrimary is set correctly.
|
|
),
|
|
);
|
|
}
|
|
}
|