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:
Dayron
2025-10-30 15:56:17 +01:00
parent 1eeea6997e
commit 2faf37f145
46 changed files with 2656 additions and 220 deletions

View File

@@ -20,8 +20,29 @@ import '../../repositories/group_repository.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
/// Create trip content widget for trip creation and editing functionality.
///
/// This widget provides a comprehensive form interface for creating new trips
/// or editing existing ones. Key features include:
/// - Trip creation with validation
/// - Location search with autocomplete
/// - Date selection for trip duration
/// - Budget planning and management
/// - Group creation and member management
/// - Account setup for expense tracking
/// - Integration with mapping services for location selection
///
/// The widget handles both creation and editing modes based on the
/// provided tripToEdit parameter.
class CreateTripContent extends StatefulWidget {
/// Optional trip to edit. If null, creates a new trip
final Trip? tripToEdit;
/// Creates a create trip content widget.
///
/// Args:
/// [tripToEdit]: Optional trip to edit. If provided, the form will
/// be populated with existing trip data for editing
const CreateTripContent({
super.key,
this.tripToEdit,
@@ -32,30 +53,44 @@ class CreateTripContent extends StatefulWidget {
}
class _CreateTripContentState extends State<CreateTripContent> {
/// Service for handling and displaying errors
final _errorService = ErrorService();
/// Form validation key
final _formKey = GlobalKey<FormState>();
/// Text controllers for form fields
final _titleController = TextEditingController();
final _descriptionController = TextEditingController();
final _locationController = TextEditingController();
final _budgetController = TextEditingController();
final _participantController = TextEditingController();
/// Services for user and group operations
final _userService = UserService();
final _groupRepository = GroupRepository();
/// Trip date variables
DateTime? _startDate;
DateTime? _endDate;
/// Loading and state management variables
bool _isLoading = false;
String? _createdTripId;
/// Google Maps API key for location services
static final String _apiKey = dotenv.env['GOOGLE_MAPS_API_KEY'] ?? '';
/// Participant management
final List<String> _participants = [];
final _participantController = TextEditingController();
/// Location autocomplete functionality
List<PlaceSuggestion> _placeSuggestions = [];
bool _isLoadingSuggestions = false;
OverlayEntry? _suggestionsOverlay;
final LayerLink _layerLink = LayerLink();
/// Determines if the widget is in editing mode
bool get isEditing => widget.tripToEdit != null;
@override