mirror of
https://github.com/AdrianKuta/android-challange-adrian-kuta.git
synced 2025-07-01 20:58:00 +02:00
This commit refactors the HomeScreen by extracting the search form logic into a new `SearchForm` composable and the passenger selection into a `PassengersOptions` composable. Key changes: - Created `PassengersOptions.kt` with a composable function to handle adult, teen, and child passenger counts. - Created `SearchForm.kt` with a composable function that encapsulates airport selection, date picking, passenger options, and the search button. - Updated `HomeScreen.kt`: - Replaced the previous inline form layout with the new `SearchForm` composable. - Made the screen content vertically scrollable using `Box` and `verticalScroll`. - Passed a new `onSearch` lambda to the `HomeScreenContent`. - Updated `HomeScreenViewModel.kt`: - Modified `updateAdultCount`, `updateTeenCount`, and `updateChildCount` to accept the new count directly instead of a diff. - Added a `search()` function (currently logs to Timber). - Ensured child count does not exceed adult count when adult count changes. - Updated `Counter.kt` in `ui/sharedui`: - Changed `onCountChange` parameter to `onValueChange` which now receives the new absolute value. - Added a `maxVal` parameter to limit the maximum value of the counter.