Files
SDKmuta/lib/theme/app_theme.dart
T
2026-10-26 20:48:16 +01:00

67 lines
2.1 KiB
Dart

import 'package:flutter/material.dart';
import '../services/app_settings.dart';
/// Shared colors and component styles. Prefer these over hardcoded
/// Colors.grey[...] so screens look alike and can be restyled in one place.
class AppTheme {
static final Color bar = Colors.grey[900]!; // app bar, bottom nav, sheets
static final Color sheet = Colors.grey[900]!;
static ThemeData light() {
return ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.white),
useMaterial3: true,
bottomSheetTheme: BottomSheetThemeData(
backgroundColor: sheet,
showDragHandle: true,
dragHandleColor: Colors.white24,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
),
),
dialogTheme: DialogThemeData(
backgroundColor: sheet,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
titleTextStyle: const TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold),
contentTextStyle: const TextStyle(color: Colors.white70, fontSize: 14),
),
);
}
static ThemeData dark() {
return light().copyWith(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue, brightness: Brightness.dark),
);
}
}
/// Card and text colors that stay readable on the current target background
/// (which can be anything from white to red to black).
class Surfaces {
final Color card;
final Color divider;
final Color textPrimary;
final Color textSecondary;
const Surfaces._({
required this.card,
required this.divider,
required this.textPrimary,
required this.textSecondary,
});
static Surfaces get current => AppSettings.instance.isLightBackground
? Surfaces._(
card: Colors.grey[300]!, // same grey as calendar cards
divider: Colors.grey[400]!,
textPrimary: Colors.black87,
textSecondary: Colors.black54,
)
: Surfaces._(
card: Colors.grey[850]!,
divider: Colors.grey[700]!,
textPrimary: Colors.white,
textSecondary: Colors.white60,
);
}