Files
TravelMate/lib/blocs/theme/theme_state.dart
Dayron 2faf37f145 Enhance model and service documentation with detailed comments and descriptions
- Updated Group, Trip, User, and other model classes to include comprehensive documentation for better understanding and maintainability.
- Improved error handling and logging in services, including AuthService, ErrorService, and StorageService.
- Added validation and business logic explanations in ExpenseService and TripService.
- Refactored method comments to follow a consistent format across the codebase.
- Translated error messages and comments from French to English for consistency.
2025-10-30 15:56:17 +01:00

38 lines
1.2 KiB
Dart

import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
/// State class for theme management.
///
/// This class represents the current theme state of the application,
/// including the selected theme mode and provides utility methods
/// for theme-related operations.
class ThemeState extends Equatable {
/// The current theme mode of the application.
final ThemeMode themeMode;
/// Creates a new [ThemeState] with the specified [themeMode].
///
/// Defaults to [ThemeMode.system] if no theme mode is provided.
const ThemeState({this.themeMode = ThemeMode.system});
/// Whether the current theme mode is explicitly set to dark.
///
/// Returns true only if the theme mode is [ThemeMode.dark].
/// Returns false for [ThemeMode.light] and [ThemeMode.system].
bool get isDarkMode {
return themeMode == ThemeMode.dark;
}
/// Creates a copy of this state with optionally modified properties.
///
/// Allows updating the theme mode while preserving other state properties.
/// Useful for state transitions in the theme BLoC.
ThemeState copyWith({ThemeMode? themeMode}) {
return ThemeState(
themeMode: themeMode ?? this.themeMode,
);
}
@override
List<Object?> get props => [themeMode];
}