تصميم عالمي جديد، وإصلاح الخرائط ومراقب السيرفرات
This commit is contained in:
@@ -1,38 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppColor {
|
||||
// --- Core Design Tokens ---
|
||||
|
||||
// Background & Surfaces
|
||||
AppColor._();
|
||||
|
||||
// ─── Dark Mode Palette (static fallback / design tokens) ─────────────────
|
||||
static const Color bg = Color(0xFF0A0A0B);
|
||||
static const Color surface = Color(0xFF161618);
|
||||
static const Color surfaceElevated = Color(0xFF222225);
|
||||
static const Color surfaceGlass = Color(0xCC161618);
|
||||
|
||||
// Accents & Branding
|
||||
static const Color accent = Color(0xFF6366F1); // Indigo / Violet
|
||||
static const Color accentSoft = Color(0x266366F1); // 15% Opacity
|
||||
static const Color accentBorder = Color(0x4D6366F1); // 30% Opacity
|
||||
|
||||
static const Color accent = Color(0xFF6366F1);
|
||||
static const Color accentSoft = Color(0x266366F1);
|
||||
static const Color accentBorder = Color(0x4D6366F1);
|
||||
static const Color glow = Color(0xFF818CF8);
|
||||
|
||||
// Semantic / State Colors
|
||||
|
||||
static const Color danger = Color(0xFFEF4444);
|
||||
static const Color dangerSoft = Color(0x26EF4444);
|
||||
static const Color success = Color(0xFF10B981);
|
||||
static const Color successSoft = Color(0x2610B981);
|
||||
static const Color warning = Color(0xFFF59E0B);
|
||||
static const Color warningSoft = Color(0x26F59E0B);
|
||||
static const Color info = Color(0xFF3B82F6);
|
||||
|
||||
// Text & Content
|
||||
static const Color infoSoft = Color(0x263B82F6);
|
||||
|
||||
static const Color textPrimary = Color(0xFFF3F4F6);
|
||||
static const Color textSecondary = Color(0xFF9CA3AF);
|
||||
static const Color textMuted = Color(0xFF6B7280);
|
||||
|
||||
// UI Elements
|
||||
|
||||
static const Color divider = Color(0xFF2D2D30);
|
||||
static const Color cardShadow = Color(0x66000000);
|
||||
|
||||
// --- Legacy Mappings (for temporary compatibility) ---
|
||||
// ─── Legacy Mappings ─────────────────────────────────────────────────────
|
||||
static const Color primaryColor = bg;
|
||||
static const Color secondaryColor = textPrimary;
|
||||
static const Color accentColor = accent;
|
||||
@@ -40,5 +38,5 @@ class AppColor {
|
||||
static const Color greenColor = success;
|
||||
static const Color blueColor = info;
|
||||
static const Color yellowColor = warning;
|
||||
static const Color deepPurpleAccent = accent; // Map to accent
|
||||
static const Color deepPurpleAccent = accent;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
import 'colors.dart';
|
||||
|
||||
class AppStyle {
|
||||
// --- Typography ---
|
||||
AppStyle._();
|
||||
|
||||
// ─── Static typography (dark mode defaults, backward compatible) ───────────
|
||||
|
||||
static TextStyle display = GoogleFonts.inter(
|
||||
fontWeight: FontWeight.w800,
|
||||
@@ -49,7 +51,91 @@ class AppStyle {
|
||||
color: AppColor.accent,
|
||||
);
|
||||
|
||||
// --- Decorations ---
|
||||
// ─── Context-aware typography (adapts to theme) ───────────────────────────
|
||||
|
||||
static TextStyle displayFor(BuildContext context) => GoogleFonts.inter(
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 32,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
letterSpacing: -1,
|
||||
);
|
||||
|
||||
static TextStyle headTitleFor(BuildContext context) => GoogleFonts.cairo(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 24,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
);
|
||||
|
||||
static TextStyle titleFor(BuildContext context) => GoogleFonts.inter(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
);
|
||||
|
||||
static TextStyle subtitleFor(BuildContext context) => GoogleFonts.inter(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
|
||||
static TextStyle bodyFor(BuildContext context) => GoogleFonts.inter(
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
);
|
||||
|
||||
static TextStyle captionFor(BuildContext context) => GoogleFonts.inter(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant.withValues(alpha: 0.6),
|
||||
);
|
||||
|
||||
static TextStyle numberFor(BuildContext context) => GoogleFonts.jetBrainsMono(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
);
|
||||
|
||||
// ─── Context-aware decorations ────────────────────────────────────────────
|
||||
|
||||
static BoxDecoration cardDecorationFor(BuildContext context) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
return BoxDecoration(
|
||||
color: cs.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: cs.outline, width: 1),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: cs.shadow.withValues(alpha: context.isDark ? 0.4 : 0.05),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
static BoxDecoration elevatedCardFor(BuildContext context) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
return BoxDecoration(
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: cs.primary.withValues(alpha: context.isDark ? 0.3 : 0.2),
|
||||
width: 1,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static BoxDecoration glassDecorationFor(BuildContext context) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
return BoxDecoration(
|
||||
color: cs.surface.withValues(alpha: context.isDark ? 0.8 : 0.9),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(color: cs.outline, width: 1),
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Legacy static decorations ────────────────────────────────────────────
|
||||
|
||||
static BoxDecoration cardDecoration = BoxDecoration(
|
||||
color: AppColor.surface,
|
||||
@@ -76,8 +162,12 @@ class AppStyle {
|
||||
border: Border.all(color: AppColor.divider, width: 1),
|
||||
);
|
||||
|
||||
// --- Legacy Mappings ---
|
||||
// ─── Legacy Mappings ─────────────────────────────────────────────────────
|
||||
static TextStyle headTitle2 = headTitle;
|
||||
static BoxDecoration boxDecoration = cardDecoration;
|
||||
static BoxDecoration boxDecoration1 = elevatedCard;
|
||||
}
|
||||
|
||||
extension _Brightness on BuildContext {
|
||||
bool get isDark => Theme.of(this).brightness == Brightness.dark;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,620 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import 'colors.dart';
|
||||
|
||||
class AppTheme {
|
||||
AppTheme._();
|
||||
|
||||
// ─── Dark Theme (Premium SaaS) ─────────────────────────────────────────────
|
||||
static ThemeData get darkTheme {
|
||||
final darkScheme = ColorScheme.dark(
|
||||
brightness: Brightness.dark,
|
||||
primary: AppColor.accent,
|
||||
onPrimary: Colors.white,
|
||||
primaryContainer: AppColor.accentSoft,
|
||||
onPrimaryContainer: AppColor.accent,
|
||||
secondary: AppColor.glow,
|
||||
onSecondary: Colors.white,
|
||||
secondaryContainer: const Color(0x26818CF8),
|
||||
onSecondaryContainer: AppColor.glow,
|
||||
tertiary: AppColor.info,
|
||||
onTertiary: Colors.white,
|
||||
surface: AppColor.surface,
|
||||
onSurface: AppColor.textPrimary,
|
||||
surfaceContainerHighest: AppColor.surfaceElevated,
|
||||
surfaceContainerHigh: const Color(0xFF1C1C1F),
|
||||
surfaceContainerMedium: const Color(0xFF1E1E21),
|
||||
surfaceContainerLow: const Color(0xFF222225),
|
||||
surfaceContainer: AppColor.surface,
|
||||
onSurfaceVariant: AppColor.textSecondary,
|
||||
error: AppColor.danger,
|
||||
onError: Colors.white,
|
||||
errorContainer: AppColor.dangerSoft,
|
||||
onErrorContainer: AppColor.danger,
|
||||
outline: AppColor.divider,
|
||||
outlineVariant: const Color(0xFF3D3D42),
|
||||
shadow: Colors.black,
|
||||
scrim: Colors.black54,
|
||||
inverseSurface: AppColor.textPrimary,
|
||||
onInverseSurface: AppColor.bg,
|
||||
inversePrimary: AppColor.glow,
|
||||
);
|
||||
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.dark,
|
||||
fontFamily: GoogleFonts.tajawal().fontFamily,
|
||||
scaffoldBackgroundColor: AppColor.bg,
|
||||
colorScheme: darkScheme,
|
||||
dividerColor: AppColor.divider,
|
||||
dividerTheme: const DividerThemeData(
|
||||
color: AppColor.divider,
|
||||
thickness: 1,
|
||||
space: 1,
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: AppColor.bg,
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
centerTitle: true,
|
||||
titleTextStyle: GoogleFonts.tajawal(
|
||||
color: AppColor.textPrimary,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
iconTheme: const IconThemeData(color: AppColor.textPrimary),
|
||||
),
|
||||
cardTheme: CardThemeData(
|
||||
color: AppColor.surface,
|
||||
elevation: 0,
|
||||
margin: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
side: const BorderSide(color: AppColor.divider, width: 1),
|
||||
),
|
||||
),
|
||||
dialogTheme: DialogThemeData(
|
||||
backgroundColor: AppColor.surface,
|
||||
elevation: 24,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
side: const BorderSide(color: AppColor.divider, width: 1),
|
||||
),
|
||||
titleTextStyle: GoogleFonts.tajawal(
|
||||
color: AppColor.textPrimary,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
contentTextStyle: GoogleFonts.tajawal(
|
||||
color: AppColor.textSecondary,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
bottomSheetTheme: const BottomSheetThemeData(
|
||||
backgroundColor: AppColor.surface,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
),
|
||||
snackBarTheme: SnackBarThemeData(
|
||||
backgroundColor: AppColor.surfaceElevated,
|
||||
contentTextStyle: GoogleFonts.tajawal(
|
||||
color: AppColor.textPrimary,
|
||||
fontSize: 14,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
filled: true,
|
||||
fillColor: AppColor.surfaceElevated,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(color: AppColor.accent, width: 1.5),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(color: AppColor.danger, width: 1),
|
||||
),
|
||||
labelStyle: const TextStyle(color: AppColor.textSecondary),
|
||||
hintStyle: const TextStyle(color: AppColor.textMuted),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColor.accent,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
textStyle: GoogleFonts.tajawal(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: AppColor.textPrimary,
|
||||
side: const BorderSide(color: AppColor.divider),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
textStyle: GoogleFonts.tajawal(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: AppColor.accent,
|
||||
textStyle: GoogleFonts.tajawal(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
switchTheme: SwitchThemeData(
|
||||
thumbColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) return AppColor.success;
|
||||
return AppColor.textMuted;
|
||||
}),
|
||||
trackColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) return AppColor.successSoft;
|
||||
return AppColor.surfaceElevated;
|
||||
}),
|
||||
),
|
||||
popupMenuTheme: PopupMenuThemeData(
|
||||
color: AppColor.surface,
|
||||
elevation: 8,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: const BorderSide(color: AppColor.divider),
|
||||
),
|
||||
),
|
||||
tooltipTheme: TooltipThemeData(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.surfaceElevated,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColor.divider),
|
||||
),
|
||||
textStyle: GoogleFonts.tajawal(
|
||||
color: AppColor.textPrimary,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
floatingActionButtonTheme: const FloatingActionButtonThemeData(
|
||||
backgroundColor: AppColor.accent,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 4,
|
||||
),
|
||||
progressIndicatorTheme: const ProgressIndicatorThemeData(
|
||||
color: AppColor.accent,
|
||||
linearTrackColor: AppColor.surfaceElevated,
|
||||
),
|
||||
tabBarTheme: TabBarThemeData(
|
||||
labelColor: AppColor.accent,
|
||||
unselectedLabelColor: AppColor.textSecondary,
|
||||
indicatorColor: AppColor.accent,
|
||||
dividerColor: AppColor.divider,
|
||||
),
|
||||
chipTheme: ChipThemeData(
|
||||
backgroundColor: AppColor.surfaceElevated,
|
||||
labelStyle: GoogleFonts.tajawal(color: AppColor.textPrimary, fontSize: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: const BorderSide(color: AppColor.divider),
|
||||
),
|
||||
),
|
||||
pageTransitionsTheme: const PageTransitionsTheme(
|
||||
builders: {
|
||||
TargetPlatform.windows: FadeUpwardsPageTransitionsBuilder(),
|
||||
TargetPlatform.macOS: FadeUpwardsPageTransitionsBuilder(),
|
||||
TargetPlatform.linux: FadeUpwardsPageTransitionsBuilder(),
|
||||
TargetPlatform.fuchsia: FadeUpwardsPageTransitionsBuilder(),
|
||||
TargetPlatform.android: CupertinoPageTransitionsBuilder(),
|
||||
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Light Theme (Premium SaaS) ────────────────────────────────────────────
|
||||
static ThemeData get lightTheme {
|
||||
const bgLight = Color(0xFFF8F9FC);
|
||||
const surfaceLight = Color(0xFFFFFFFF);
|
||||
const surfaceElevatedLight = Color(0xFFF1F3F9);
|
||||
const dividerLight = Color(0xFFE2E5ED);
|
||||
const textPrimaryLight = Color(0xFF111827);
|
||||
const textSecondaryLight = Color(0xFF6B7280);
|
||||
const textMutedLight = Color(0xFF9CA3AF);
|
||||
const accentLight = Color(0xFF6366F1);
|
||||
const accentSoftLight = Color(0x1A6366F1);
|
||||
const accentBorderLight = Color(0x336366F1);
|
||||
const glowLight = Color(0xFF4F46E5);
|
||||
const dangerLight = Color(0xFFDC2626);
|
||||
const dangerSoftLight = Color(0x1ADC2626);
|
||||
const successLight = Color(0xFF059669);
|
||||
const successSoftLight = Color(0x1A059669);
|
||||
const warningLight = Color(0xFFD97706);
|
||||
const infoLight = Color(0xFF2563EB);
|
||||
|
||||
final lightScheme = ColorScheme.light(
|
||||
brightness: Brightness.light,
|
||||
primary: accentLight,
|
||||
onPrimary: Colors.white,
|
||||
primaryContainer: accentSoftLight,
|
||||
onPrimaryContainer: accentLight,
|
||||
secondary: glowLight,
|
||||
onSecondary: Colors.white,
|
||||
secondaryContainer: const Color(0x1A4F46E5),
|
||||
onSecondaryContainer: glowLight,
|
||||
tertiary: infoLight,
|
||||
onTertiary: Colors.white,
|
||||
surface: surfaceLight,
|
||||
onSurface: textPrimaryLight,
|
||||
surfaceContainerHighest: surfaceElevatedLight,
|
||||
surfaceContainerHigh: const Color(0xFFF5F6FA),
|
||||
surfaceContainerMedium: const Color(0xFFF8F9FC),
|
||||
surfaceContainerLow: const Color(0xFFFAFBFD),
|
||||
surfaceContainer: surfaceLight,
|
||||
onSurfaceVariant: textSecondaryLight,
|
||||
error: dangerLight,
|
||||
onError: Colors.white,
|
||||
errorContainer: dangerSoftLight,
|
||||
onErrorContainer: dangerLight,
|
||||
outline: dividerLight,
|
||||
outlineVariant: const Color(0xFFD1D5DB),
|
||||
shadow: Colors.black26,
|
||||
scrim: Colors.black38,
|
||||
inverseSurface: textPrimaryLight,
|
||||
onInverseSurface: surfaceLight,
|
||||
inversePrimary: const Color(0xFFC7D2FE),
|
||||
);
|
||||
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.light,
|
||||
fontFamily: GoogleFonts.tajawal().fontFamily,
|
||||
scaffoldBackgroundColor: bgLight,
|
||||
colorScheme: lightScheme,
|
||||
dividerColor: dividerLight,
|
||||
dividerTheme: const DividerThemeData(
|
||||
color: dividerLight,
|
||||
thickness: 1,
|
||||
space: 1,
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: bgLight,
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
centerTitle: true,
|
||||
titleTextStyle: GoogleFonts.tajawal(
|
||||
color: textPrimaryLight,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
iconTheme: const IconThemeData(color: textPrimaryLight),
|
||||
),
|
||||
cardTheme: CardThemeData(
|
||||
color: surfaceLight,
|
||||
elevation: 0,
|
||||
margin: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
side: const BorderSide(color: dividerLight, width: 1),
|
||||
),
|
||||
),
|
||||
dialogTheme: DialogThemeData(
|
||||
backgroundColor: surfaceLight,
|
||||
elevation: 24,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
side: const BorderSide(color: dividerLight, width: 1),
|
||||
),
|
||||
titleTextStyle: GoogleFonts.tajawal(
|
||||
color: textPrimaryLight,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
contentTextStyle: GoogleFonts.tajawal(
|
||||
color: textSecondaryLight,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
bottomSheetTheme: const BottomSheetThemeData(
|
||||
backgroundColor: surfaceLight,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
),
|
||||
snackBarTheme: SnackBarThemeData(
|
||||
backgroundColor: surfaceElevatedLight,
|
||||
contentTextStyle: GoogleFonts.tajawal(
|
||||
color: textPrimaryLight,
|
||||
fontSize: 14,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
filled: true,
|
||||
fillColor: surfaceElevatedLight,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(color: accentLight, width: 1.5),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(color: dangerLight, width: 1),
|
||||
),
|
||||
labelStyle: const TextStyle(color: textSecondaryLight),
|
||||
hintStyle: const TextStyle(color: textMutedLight),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: accentLight,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
textStyle: GoogleFonts.tajawal(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: textPrimaryLight,
|
||||
side: const BorderSide(color: dividerLight),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
textStyle: GoogleFonts.tajawal(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: accentLight,
|
||||
textStyle: GoogleFonts.tajawal(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
switchTheme: SwitchThemeData(
|
||||
thumbColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) return successLight;
|
||||
return textMutedLight;
|
||||
}),
|
||||
trackColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) return successSoftLight;
|
||||
return surfaceElevatedLight;
|
||||
}),
|
||||
),
|
||||
popupMenuTheme: PopupMenuThemeData(
|
||||
color: surfaceLight,
|
||||
elevation: 8,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: const BorderSide(color: dividerLight),
|
||||
),
|
||||
),
|
||||
tooltipTheme: TooltipThemeData(
|
||||
decoration: BoxDecoration(
|
||||
color: surfaceElevatedLight,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: dividerLight),
|
||||
),
|
||||
textStyle: GoogleFonts.tajawal(
|
||||
color: textPrimaryLight,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
floatingActionButtonTheme: const FloatingActionButtonThemeData(
|
||||
backgroundColor: accentLight,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 4,
|
||||
),
|
||||
progressIndicatorTheme: const ProgressIndicatorThemeData(
|
||||
color: accentLight,
|
||||
linearTrackColor: surfaceElevatedLight,
|
||||
),
|
||||
tabBarTheme: TabBarThemeData(
|
||||
labelColor: accentLight,
|
||||
unselectedLabelColor: textSecondaryLight,
|
||||
indicatorColor: accentLight,
|
||||
dividerColor: dividerLight,
|
||||
),
|
||||
chipTheme: ChipThemeData(
|
||||
backgroundColor: surfaceElevatedLight,
|
||||
labelStyle: GoogleFonts.tajawal(color: textPrimaryLight, fontSize: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: const BorderSide(color: dividerLight),
|
||||
),
|
||||
),
|
||||
pageTransitionsTheme: const PageTransitionsTheme(
|
||||
builders: {
|
||||
TargetPlatform.windows: FadeUpwardsPageTransitionsBuilder(),
|
||||
TargetPlatform.macOS: FadeUpwardsPageTransitionsBuilder(),
|
||||
TargetPlatform.linux: FadeUpwardsPageTransitionsBuilder(),
|
||||
TargetPlatform.fuchsia: FadeUpwardsPageTransitionsBuilder(),
|
||||
TargetPlatform.android: CupertinoPageTransitionsBuilder(),
|
||||
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Context Extensions for Theme Access ──────────────────────────────────────
|
||||
|
||||
extension ThemeExtensions on BuildContext {
|
||||
ColorScheme get colors => Theme.of(this).colorScheme;
|
||||
TextTheme get textStyles => Theme.of(this).textTheme;
|
||||
Brightness get brightness => Theme.of(this).brightness;
|
||||
bool get isDark => brightness == Brightness.dark;
|
||||
}
|
||||
|
||||
// ─── Semantic Color Getters (light/dark adaptive) ─────────────────────────────
|
||||
// These replace direct AppColor.* usage in views. They automatically adapt
|
||||
// based on the current theme brightness.
|
||||
|
||||
class AppColors {
|
||||
AppColors._();
|
||||
|
||||
static Color bg(BuildContext context) => context.isDark
|
||||
? const Color(0xFF0A0A0B)
|
||||
: const Color(0xFFF8F9FC);
|
||||
|
||||
static Color surface(BuildContext context) => context.isDark
|
||||
? const Color(0xFF161618)
|
||||
: const Color(0xFFFFFFFF);
|
||||
|
||||
static Color surfaceElevated(BuildContext context) => context.isDark
|
||||
? const Color(0xFF222225)
|
||||
: const Color(0xFFF1F3F9);
|
||||
|
||||
static Color surfaceGlass(BuildContext context) => context.isDark
|
||||
? const Color(0xCC161618)
|
||||
: const Color(0xCCFFFFFF);
|
||||
|
||||
static Color accent(BuildContext context) => context.isDark
|
||||
? const Color(0xFF6366F1)
|
||||
: const Color(0xFF6366F1);
|
||||
|
||||
static Color accentSoft(BuildContext context) => context.isDark
|
||||
? const Color(0x266366F1)
|
||||
: const Color(0x1A6366F1);
|
||||
|
||||
static Color accentBorder(BuildContext context) => context.isDark
|
||||
? const Color(0x4D6366F1)
|
||||
: const Color(0x336366F1);
|
||||
|
||||
static Color glow(BuildContext context) => context.isDark
|
||||
? const Color(0xFF818CF8)
|
||||
: const Color(0xFF4F46E5);
|
||||
|
||||
static Color danger(BuildContext context) => context.isDark
|
||||
? const Color(0xFFEF4444)
|
||||
: const Color(0xFFDC2626);
|
||||
|
||||
static Color dangerSoft(BuildContext context) => context.isDark
|
||||
? const Color(0x26EF4444)
|
||||
: const Color(0x1ADC2626);
|
||||
|
||||
static Color success(BuildContext context) => context.isDark
|
||||
? const Color(0xFF10B981)
|
||||
: const Color(0xFF059669);
|
||||
|
||||
static Color successSoft(BuildContext context) => context.isDark
|
||||
? const Color(0x2610B981)
|
||||
: const Color(0x1A059669);
|
||||
|
||||
static Color warning(BuildContext context) => context.isDark
|
||||
? const Color(0xFFF59E0B)
|
||||
: const Color(0xFFD97706);
|
||||
|
||||
static Color warningSoft(BuildContext context) => context.isDark
|
||||
? const Color(0x26F59E0B)
|
||||
: const Color(0x1AD97706);
|
||||
|
||||
static Color info(BuildContext context) => context.isDark
|
||||
? const Color(0xFF3B82F6)
|
||||
: const Color(0xFF2563EB);
|
||||
|
||||
static Color infoSoft(BuildContext context) => context.isDark
|
||||
? const Color(0x263B82F6)
|
||||
: const Color(0x1A2563EB);
|
||||
|
||||
static Color textPrimary(BuildContext context) => context.isDark
|
||||
? const Color(0xFFF3F4F6)
|
||||
: const Color(0xFF111827);
|
||||
|
||||
static Color textSecondary(BuildContext context) => context.isDark
|
||||
? const Color(0xFF9CA3AF)
|
||||
: const Color(0xFF6B7280);
|
||||
|
||||
static Color textMuted(BuildContext context) => context.isDark
|
||||
? const Color(0xFF6B7280)
|
||||
: const Color(0xFF9CA3AF);
|
||||
|
||||
static Color divider(BuildContext context) => context.isDark
|
||||
? const Color(0xFF2D2D30)
|
||||
: const Color(0xFFE2E5ED);
|
||||
|
||||
static Color cardShadow(BuildContext context) => context.isDark
|
||||
? const Color(0x66000000)
|
||||
: const Color(0x0D000000);
|
||||
|
||||
// Gradient helpers for charts
|
||||
static LinearGradient accentGradient(BuildContext context) => LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
accent(context).withValues(alpha: 0.4),
|
||||
accent(context).withValues(alpha: 0.0),
|
||||
],
|
||||
);
|
||||
|
||||
static LinearGradient successGradient(BuildContext context) => LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
success(context).withValues(alpha: 0.4),
|
||||
success(context).withValues(alpha: 0.0),
|
||||
],
|
||||
);
|
||||
|
||||
static LinearGradient dangerGradient(BuildContext context) => LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
danger(context).withValues(alpha: 0.4),
|
||||
danger(context).withValues(alpha: 0.0),
|
||||
],
|
||||
);
|
||||
|
||||
static LinearGradient infoGradient(BuildContext context) => LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
info(context).withValues(alpha: 0.4),
|
||||
info(context).withValues(alpha: 0.0),
|
||||
],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user