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.
This commit is contained in:
@@ -9,7 +9,20 @@ import '../../blocs/trip/trip_state.dart';
|
||||
import '../../blocs/trip/trip_event.dart';
|
||||
import '../../models/trip.dart';
|
||||
|
||||
/// Home content widget for the main application dashboard.
|
||||
///
|
||||
/// This widget serves as the primary content area of the home screen,
|
||||
/// displaying user trips and providing navigation to trip management
|
||||
/// features. Key functionality includes:
|
||||
/// - Loading and displaying user trips
|
||||
/// - Creating new trips
|
||||
/// - Viewing trip details
|
||||
/// - Managing trip state with proper user authentication
|
||||
///
|
||||
/// The widget maintains state persistence using AutomaticKeepAliveClientMixin
|
||||
/// to preserve content when switching between tabs.
|
||||
class HomeContent extends StatefulWidget {
|
||||
/// Creates a home content widget.
|
||||
const HomeContent({super.key});
|
||||
|
||||
@override
|
||||
@@ -17,20 +30,27 @@ class HomeContent extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _HomeContentState extends State<HomeContent> with AutomaticKeepAliveClientMixin {
|
||||
/// Preserves widget state when switching between tabs
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
/// Flag to prevent duplicate trip loading operations
|
||||
bool _hasLoadedTrips = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// MODIFIÉ : Utiliser addPostFrameCallback pour attendre que le widget tree soit prêt
|
||||
// Use addPostFrameCallback to wait for the widget tree to be ready
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_loadTripsIfUserLoaded();
|
||||
});
|
||||
}
|
||||
|
||||
/// Loads trips if a user is currently loaded and trips haven't been loaded yet.
|
||||
///
|
||||
/// Checks the current user state and initiates trip loading if the user is
|
||||
/// authenticated and trips haven't been loaded previously. This prevents
|
||||
/// duplicate loading operations.
|
||||
void _loadTripsIfUserLoaded() {
|
||||
if (!_hasLoadedTrips && mounted) {
|
||||
final userState = context.read<UserBloc>().state;
|
||||
|
||||
Reference in New Issue
Block a user