mirror of
https://github.com/AdrianKuta/android-challange-adrian-kuta.git
synced 2025-07-01 20:58:00 +02:00
This commit introduces a passenger counter component to the home screen, allowing users to specify the number of adults, teens, and children for their flight search. Key changes: - Added `ui:sharedui` module dependency to `ui:home`. - Updated `PreviewDevices` annotation to include `showBackground = true`. - Modified `HomeScreen`: - Added parameters to `HomeContent` and `SearchForm` for passenger count change callbacks. - Integrated the `Counter` composable from `ui:sharedui` for adults, teens, and children. - Added `VerticalDivider` between counters. - Updated previews to reflect passenger counter integration. - Updated `HomeScreenViewModel`: - Introduced `MutableStateFlow` for `adultCount`, `teenCount`, and `childCount`. - Created `passengersState` flow by combining individual passenger count flows. - Updated `homeUiState` to include `passengersState`. - Added public functions `updateAdultCount`, `updateTeenCount`, and `updateChildCount` to modify passenger counts with validation. - Added `PassengersState` data class to hold passenger counts. - Updated `Counter` composable in `ui:sharedui`: - Added an optional `minVal` parameter (defaulting to 0) to define the minimum allowed value for the counter. - Ensured the decrement button is disabled when the counter value reaches `minVal`. - Centered text in increment and decrement buttons.
20 lines
505 B
Plaintext
20 lines
505 B
Plaintext
plugins {
|
|
alias(libs.plugins.flights.android.library.compose)
|
|
alias(libs.plugins.flights.android.library.hilt)
|
|
alias(libs.plugins.kotlin.serialization)
|
|
}
|
|
|
|
android {
|
|
namespace = "dev.adriankuta.flights.ui.home"
|
|
}
|
|
|
|
dependencies {
|
|
implementation(projects.core.util)
|
|
implementation(projects.ui.designsystem)
|
|
implementation(projects.ui.sharedui)
|
|
implementation(projects.domain.search)
|
|
|
|
implementation(libs.androidx.hilt.navigation.compose)
|
|
implementation(libs.timber)
|
|
}
|