97 lines
4.1 KiB
Dart
97 lines
4.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// Satu sumber kebenaran untuk semua warna, style, dan theme aplikasi.
|
|
class AppTheme {
|
|
AppTheme._();
|
|
|
|
// ── Brand Colors ─────────────────────────────────────────────
|
|
static const Color primary = Color(0xFF3E5F6F);
|
|
static const Color primaryLight = Color(0xFF5A7F91);
|
|
static const Color primaryDark = Color(0xFF2B4555);
|
|
|
|
static const Color accent = Color(0xFF2196F3);
|
|
static const Color accentLight = Color(0xFFE3F2FD);
|
|
|
|
// ── Backgrounds ──────────────────────────────────────────────
|
|
static const Color bgPage = Color(0xFFF4F6FA);
|
|
static const Color bgCard = Colors.white;
|
|
static const Color bgAuth = Color(0xFFF6F6F6);
|
|
|
|
// ── Text ─────────────────────────────────────────────────────
|
|
static const Color textPrimary = Color(0xFF1A1A2E);
|
|
static const Color textSecondary = Color(0xFF6B7280);
|
|
static const Color textHint = Color(0xFF9CA3AF);
|
|
|
|
// ── Status ───────────────────────────────────────────────────
|
|
static const Color statusNormal = Color(0xFF4CAF50);
|
|
static const Color statusWarning = Colors.orange;
|
|
static const Color statusDanger = Colors.red;
|
|
|
|
// ── Gradients ────────────────────────────────────────────────
|
|
static const LinearGradient suhuGradient = LinearGradient(
|
|
colors: [Color(0xFFB026FF), Color(0xFF7B2FBE)],
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
);
|
|
|
|
static const LinearGradient humidGradient = LinearGradient(
|
|
colors: [Color(0xFF56CCF2), Color(0xFF2F80ED)],
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
);
|
|
|
|
// ── Card Decoration ──────────────────────────────────────────
|
|
static BoxDecoration cardDecoration({double radius = 16}) => BoxDecoration(
|
|
color: bgCard,
|
|
borderRadius: BorderRadius.circular(radius),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.06),
|
|
blurRadius: 12,
|
|
offset: const Offset(0, 4),
|
|
),
|
|
],
|
|
);
|
|
|
|
// ── ThemeData ─────────────────────────────────────────────────
|
|
static ThemeData get light {
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: ColorScheme.fromSeed(seedColor: primary),
|
|
scaffoldBackgroundColor: bgPage,
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: bgPage,
|
|
elevation: 0,
|
|
scrolledUnderElevation: 0,
|
|
foregroundColor: textPrimary,
|
|
),
|
|
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
|
|
backgroundColor: bgCard,
|
|
selectedItemColor: primary,
|
|
unselectedItemColor: textSecondary,
|
|
type: BottomNavigationBarType.fixed,
|
|
elevation: 8,
|
|
),
|
|
switchTheme: SwitchThemeData(
|
|
thumbColor: WidgetStateProperty.resolveWith((states) {
|
|
if (states.contains(WidgetState.selected)) return Colors.white;
|
|
return Colors.grey.shade400;
|
|
}),
|
|
trackColor: WidgetStateProperty.resolveWith((states) {
|
|
if (states.contains(WidgetState.selected)) return accent;
|
|
return Colors.grey.shade300;
|
|
}),
|
|
),
|
|
sliderTheme: SliderThemeData(
|
|
trackHeight: 4,
|
|
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 8),
|
|
overlayShape: const RoundSliderOverlayShape(overlayRadius: 16),
|
|
activeTrackColor: Colors.white,
|
|
inactiveTrackColor: Colors.white.withOpacity(0.3),
|
|
thumbColor: Colors.white,
|
|
overlayColor: Colors.white.withOpacity(0.2),
|
|
),
|
|
);
|
|
}
|
|
}
|