Files
android-challange-adrian-kuta/ui
Adrian Kuta 6f6b886418 feat: Add DatePicker to HomeScreen for flight date selection
This commit introduces a DatePicker component to the HomeScreen, allowing users to select a departure date for their flight search.

Key changes:
- Created a reusable `DatePicker` composable in `ui/home/src/main/kotlin/dev/adriankuta/flights/ui/home/components/DatePicker.kt`.
    - This component uses Material 3 `DatePicker` and `DatePickerDialog`.
    - It ensures that only future dates can be selected using a custom `FutureSelectableDates` class.
    - The date is displayed in "yyyy-MM-dd" format.
    - Clicking the `OutlinedTextField` opens the `DatePickerDialog`.
- Integrated the `DatePicker` into `HomeScreen.kt`.
    - The `DatePicker` is placed below the destination airport dropdown.
    - It is enabled only after a destination airport is selected.
    - The selected date is passed from and updated in the `HomeScreenViewModel`.
- Updated `HomeScreenViewModel.kt`:
    - Added a `selectedDate` `MutableStateFlow` initialized with the current date.
    - Implemented a `selectDate` function to update `selectedDate`.
    - Included `selectedDate` in the `homeUiState` flow and `HomeUiState.Success` data class.
- Updated `HomeScreenPreview` and `HomeScreenPreviewSuccess` to include the new `onDateSelect` parameter and provide a `selectedDate` for the success state.
2025-06-13 23:09:48 +02:00
..