mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-17 20:29:30 +02:00
feat: Add XtremFlow color palette for light/dark themes and initial Flutter web HTML with a themed loading screen.
This commit is contained in:
1 parent
b56ecdb145
commit
0fc4a15f40
8 files changed
+1133
-41
No files matched your search
@@ -0,0 +1,111 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
/// Theme mode preference options
|
||||
enum AppThemeMode {
|
||||
system, // Follow system preference
|
||||
light, // Force light mode
|
||||
dark, // Force dark mode
|
||||
}
|
||||
|
||||
/// Keys for SharedPreferences storage
|
||||
class _ThemeKeys {
|
||||
static const String themeMode = 'app_theme_mode';
|
||||
}
|
||||
|
||||
/// Theme state containing current mode
|
||||
class ThemeState {
|
||||
final AppThemeMode appThemeMode;
|
||||
final ThemeMode themeMode;
|
||||
|
||||
const ThemeState({
|
||||
this.appThemeMode = AppThemeMode.dark,
|
||||
this.themeMode = ThemeMode.dark,
|
||||
});
|
||||
|
||||
ThemeState copyWith({
|
||||
AppThemeMode? appThemeMode,
|
||||
ThemeMode? themeMode,
|
||||
}) {
|
||||
return ThemeState(
|
||||
appThemeMode: appThemeMode ?? this.appThemeMode,
|
||||
themeMode: themeMode ?? this.themeMode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Theme provider for managing light/dark mode with persistence
|
||||
class ThemeNotifier extends StateNotifier<ThemeState> {
|
||||
ThemeNotifier() : super(const ThemeState()) {
|
||||
_loadTheme();
|
||||
}
|
||||
|
||||
/// Load saved theme preference from SharedPreferences
|
||||
Future<void> _loadTheme() async {
|
||||
try {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final savedMode = prefs.getString(_ThemeKeys.themeMode);
|
||||
|
||||
if (savedMode != null) {
|
||||
final appMode = AppThemeMode.values.firstWhere(
|
||||
(e) => e.name == savedMode,
|
||||
orElse: () => AppThemeMode.dark,
|
||||
);
|
||||
state = state.copyWith(
|
||||
appThemeMode: appMode,
|
||||
themeMode: _mapToThemeMode(appMode),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('Error loading theme: $e');
|
||||
}
|
||||
}
|
||||
|
||||
/// Set theme mode and persist to SharedPreferences
|
||||
Future<void> setThemeMode(AppThemeMode mode) async {
|
||||
state = state.copyWith(
|
||||
appThemeMode: mode,
|
||||
themeMode: _mapToThemeMode(mode),
|
||||
);
|
||||
|
||||
try {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString(_ThemeKeys.themeMode, mode.name);
|
||||
} catch (e) {
|
||||
debugPrint('Error saving theme: $e');
|
||||
}
|
||||
}
|
||||
|
||||
/// Quick toggle between light and dark (skip system)
|
||||
Future<void> toggleTheme() async {
|
||||
final newMode = state.appThemeMode == AppThemeMode.dark
|
||||
? AppThemeMode.light
|
||||
: AppThemeMode.dark;
|
||||
await setThemeMode(newMode);
|
||||
}
|
||||
|
||||
/// Check if currently in dark mode
|
||||
bool get isDarkMode {
|
||||
return state.themeMode == ThemeMode.dark ||
|
||||
(state.themeMode == ThemeMode.system &&
|
||||
WidgetsBinding.instance.platformDispatcher.platformBrightness == Brightness.dark);
|
||||
}
|
||||
|
||||
/// Map AppThemeMode to Flutter's ThemeMode
|
||||
ThemeMode _mapToThemeMode(AppThemeMode mode) {
|
||||
switch (mode) {
|
||||
case AppThemeMode.system:
|
||||
return ThemeMode.system;
|
||||
case AppThemeMode.light:
|
||||
return ThemeMode.light;
|
||||
case AppThemeMode.dark:
|
||||
return ThemeMode.dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Provider for theme state
|
||||
final themeProvider = StateNotifierProvider<ThemeNotifier, ThemeState>((ref) {
|
||||
return ThemeNotifier();
|
||||
});
|
||||
@@ -2,16 +2,16 @@ import 'package:flutter/material.dart';
|
||||
|
||||
/// XtremFlow Premium Color Palette
|
||||
///
|
||||
/// Modern dark theme with cyan/teal gradients
|
||||
/// Modern theme with cyan/teal gradients - supports light and dark modes
|
||||
class AppColors {
|
||||
AppColors._();
|
||||
|
||||
// ============ PRIMARY GRADIENT ============
|
||||
/// Cyan primary - main accent color
|
||||
static const Color primary = Color(0xFF00D9FF);
|
||||
static const Color primary = Color(0xFF00BCD4);
|
||||
|
||||
/// Teal secondary - gradient end
|
||||
static const Color secondary = Color(0xFF00BFA5);
|
||||
static const Color secondary = Color(0xFF00ACC1);
|
||||
|
||||
/// Primary gradient for buttons and highlights
|
||||
static const LinearGradient primaryGradient = LinearGradient(
|
||||
@@ -20,31 +20,51 @@ class AppColors {
|
||||
end: Alignment.bottomRight,
|
||||
);
|
||||
|
||||
// ============ SURFACE COLORS ============
|
||||
// ============ DARK MODE SURFACE COLORS ============
|
||||
/// Deep dark background
|
||||
static const Color background = Color(0xFF0A0E14);
|
||||
static const Color backgroundDark = Color(0xFF0A0E1A);
|
||||
|
||||
/// Card/elevated surface
|
||||
static const Color surface = Color(0xFF141A22);
|
||||
/// Card/elevated surface (dark)
|
||||
static const Color surfaceDark = Color(0xFF121829);
|
||||
|
||||
/// Lighter surface variant (hover states, inputs)
|
||||
static const Color surfaceVariant = Color(0xFF1E2630);
|
||||
/// Lighter surface variant (dark)
|
||||
static const Color surfaceVariantDark = Color(0xFF1E2638);
|
||||
|
||||
/// Border/divider color
|
||||
static const Color border = Color(0xFF2A3441);
|
||||
|
||||
/// Overlay color (modals, dialogs)
|
||||
static const Color overlay = Color(0xCC0A0E14);
|
||||
/// Border/divider color (dark)
|
||||
static const Color borderDark = Color(0xFF2A3441);
|
||||
|
||||
// ============ TEXT COLORS ============
|
||||
/// Primary text - white with high opacity
|
||||
static const Color textPrimary = Color(0xFFF5F5F5);
|
||||
// ============ LIGHT MODE SURFACE COLORS ============
|
||||
/// Light background
|
||||
static const Color backgroundLight = Color(0xFFF5F7FA);
|
||||
|
||||
/// Secondary text - muted
|
||||
static const Color textSecondary = Color(0xFFB0BEC5);
|
||||
/// Card/elevated surface (light)
|
||||
static const Color surfaceLight = Color(0xFFFFFFFF);
|
||||
|
||||
/// Disabled/hint text
|
||||
static const Color textDisabled = Color(0xFF607D8B);
|
||||
/// Lighter surface variant (light)
|
||||
static const Color surfaceVariantLight = Color(0xFFF0F2F5);
|
||||
|
||||
/// Border/divider color (light)
|
||||
static const Color borderLight = Color(0xFFE2E8F0);
|
||||
|
||||
// ============ DARK MODE TEXT COLORS ============
|
||||
static const Color textPrimaryDark = Color(0xFFF5F5F5);
|
||||
static const Color textSecondaryDark = Color(0xFF94A3B8);
|
||||
static const Color textDisabledDark = Color(0xFF64748B);
|
||||
|
||||
// ============ LIGHT MODE TEXT COLORS ============
|
||||
static const Color textPrimaryLight = Color(0xFF1A1A2E);
|
||||
static const Color textSecondaryLight = Color(0xFF64748B);
|
||||
static const Color textDisabledLight = Color(0xFF94A3B8);
|
||||
|
||||
// ============ LEGACY ALIASES (for backwards compatibility) ============
|
||||
static const Color background = backgroundDark;
|
||||
static const Color surface = surfaceDark;
|
||||
static const Color surfaceVariant = surfaceVariantDark;
|
||||
static const Color border = borderDark;
|
||||
static const Color textPrimary = textPrimaryDark;
|
||||
static const Color textSecondary = textSecondaryDark;
|
||||
static const Color textDisabled = textDisabledDark;
|
||||
static const Color overlay = Color(0xCC0A0E14);
|
||||
|
||||
// ============ ACCENT COLORS ============
|
||||
/// Live indicator red
|
||||
@@ -63,7 +83,6 @@ class AppColors {
|
||||
static const Color info = Color(0xFF3B82F6);
|
||||
|
||||
// ============ CATEGORY COLORS ============
|
||||
/// Colors for category chips/tags
|
||||
static const List<Color> categoryColors = [
|
||||
Color(0xFF6366F1), // Indigo
|
||||
Color(0xFFEC4899), // Pink
|
||||
@@ -74,21 +93,33 @@ class AppColors {
|
||||
];
|
||||
|
||||
// ============ GLASSMORPHISM ============
|
||||
/// Glass effect background color
|
||||
static const Color glassBackground = Color(0x1AFFFFFF);
|
||||
|
||||
/// Glass border color
|
||||
static const Color glassBorder = Color(0x33FFFFFF);
|
||||
static const Color glassBackgroundLight = Color(0x40FFFFFF);
|
||||
static const Color glassBorderLight = Color(0x20000000);
|
||||
|
||||
// ============ DARK THEME COLOR SCHEME ============
|
||||
static ColorScheme get darkColorScheme => const ColorScheme.dark(
|
||||
primary: primary,
|
||||
secondary: secondary,
|
||||
surface: surface,
|
||||
surface: surfaceDark,
|
||||
error: error,
|
||||
onPrimary: Color(0xFF000000),
|
||||
onSecondary: Color(0xFF000000),
|
||||
onSurface: textPrimary,
|
||||
onSurface: textPrimaryDark,
|
||||
onError: Color(0xFFFFFFFF),
|
||||
);
|
||||
|
||||
// ============ LIGHT THEME COLOR SCHEME ============
|
||||
static ColorScheme get lightColorScheme => const ColorScheme.light(
|
||||
primary: primary,
|
||||
secondary: secondary,
|
||||
surface: surfaceLight,
|
||||
error: error,
|
||||
onPrimary: Color(0xFFFFFFFF),
|
||||
onSecondary: Color(0xFFFFFFFF),
|
||||
onSurface: textPrimaryLight,
|
||||
onError: Color(0xFFFFFFFF),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -388,4 +388,236 @@ class AppTheme {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ============ LIGHT THEME ============
|
||||
static ThemeData get lightTheme {
|
||||
final baseTheme = ThemeData.light(useMaterial3: true);
|
||||
|
||||
return baseTheme.copyWith(
|
||||
colorScheme: AppColors.lightColorScheme,
|
||||
scaffoldBackgroundColor: AppColors.backgroundLight,
|
||||
|
||||
// AppBar
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: AppColors.surfaceLight,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
centerTitle: false,
|
||||
titleTextStyle: GoogleFonts.inter(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
iconTheme: const IconThemeData(color: AppColors.textPrimaryLight),
|
||||
),
|
||||
|
||||
// Navigation Bar (bottom)
|
||||
navigationBarTheme: NavigationBarThemeData(
|
||||
backgroundColor: AppColors.surfaceLight,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
indicatorColor: AppColors.primary.withOpacity(0.15),
|
||||
labelTextStyle: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
return GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.primary,
|
||||
);
|
||||
}
|
||||
return GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.textSecondaryLight,
|
||||
);
|
||||
}),
|
||||
iconTheme: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
return const IconThemeData(color: AppColors.primary);
|
||||
}
|
||||
return const IconThemeData(color: AppColors.textSecondaryLight);
|
||||
}),
|
||||
),
|
||||
|
||||
// Navigation Rail (desktop sidebar)
|
||||
navigationRailTheme: NavigationRailThemeData(
|
||||
backgroundColor: AppColors.surfaceLight,
|
||||
indicatorColor: AppColors.primary.withOpacity(0.15),
|
||||
selectedIconTheme: const IconThemeData(color: AppColors.primary),
|
||||
unselectedIconTheme: const IconThemeData(color: AppColors.textSecondaryLight),
|
||||
selectedLabelTextStyle: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
unselectedLabelTextStyle: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.textSecondaryLight,
|
||||
),
|
||||
),
|
||||
|
||||
// Cards
|
||||
cardTheme: CardThemeData(
|
||||
color: AppColors.surfaceLight,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
elevation: 2,
|
||||
shadowColor: Colors.black.withOpacity(0.08),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(radiusMd),
|
||||
),
|
||||
margin: EdgeInsets.zero,
|
||||
),
|
||||
|
||||
// Inputs
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
filled: true,
|
||||
fillColor: AppColors.surfaceVariantLight,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(radiusSm),
|
||||
borderSide: const BorderSide(color: AppColors.borderLight),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(radiusSm),
|
||||
borderSide: const BorderSide(color: AppColors.borderLight),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(radiusSm),
|
||||
borderSide: const BorderSide(color: AppColors.primary, width: 2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(radiusSm),
|
||||
borderSide: const BorderSide(color: AppColors.error),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: spacing16,
|
||||
vertical: spacing12,
|
||||
),
|
||||
hintStyle: GoogleFonts.inter(
|
||||
color: AppColors.textDisabledLight,
|
||||
fontSize: 14,
|
||||
),
|
||||
labelStyle: GoogleFonts.inter(
|
||||
color: AppColors.textSecondaryLight,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
|
||||
// Buttons
|
||||
filledButtonTheme: FilledButtonThemeData(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: AppColors.primary,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: spacing24,
|
||||
vertical: spacing12,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(radiusSm),
|
||||
),
|
||||
textStyle: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Dialogs
|
||||
dialogTheme: DialogThemeData(
|
||||
backgroundColor: AppColors.surfaceLight,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(radiusLg),
|
||||
),
|
||||
titleTextStyle: GoogleFonts.inter(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
contentTextStyle: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
color: AppColors.textSecondaryLight,
|
||||
),
|
||||
),
|
||||
|
||||
// Dividers
|
||||
dividerTheme: const DividerThemeData(
|
||||
color: AppColors.borderLight,
|
||||
thickness: 1,
|
||||
space: 1,
|
||||
),
|
||||
|
||||
// List tiles
|
||||
listTileTheme: ListTileThemeData(
|
||||
tileColor: Colors.transparent,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: spacing16,
|
||||
vertical: spacing8,
|
||||
),
|
||||
titleTextStyle: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
subtitleTextStyle: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
color: AppColors.textSecondaryLight,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(radiusSm),
|
||||
),
|
||||
),
|
||||
|
||||
// Progress indicators
|
||||
progressIndicatorTheme: const ProgressIndicatorThemeData(
|
||||
color: AppColors.primary,
|
||||
linearTrackColor: AppColors.surfaceVariantLight,
|
||||
circularTrackColor: AppColors.surfaceVariantLight,
|
||||
),
|
||||
|
||||
// Text theme
|
||||
textTheme: TextTheme(
|
||||
displayLarge: GoogleFonts.inter(
|
||||
fontSize: 57,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
headlineLarge: GoogleFonts.inter(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
titleLarge: GoogleFonts.inter(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
titleMedium: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
bodyLarge: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
bodyMedium: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
bodySmall: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textSecondaryLight,
|
||||
),
|
||||
labelLarge: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user