Skip to content

Commit

Permalink
[#623] Use FlowRow from Androidx and remove Accompanist Flow Layout d…
Browse files Browse the repository at this point in the history
…ependency
  • Loading branch information
florentmaitre committed Sep 27, 2023
1 parent 782b107 commit 74b62ac
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
1 change: 0 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ dependencies {
implementation(project(":lib-xml"))
implementation(project(":theme-innovation-cup"))

implementation(Dependencies.accompanistFlowLayout)
implementation(Dependencies.accompanistSystemUiController)
implementation(Dependencies.activityCompose)
implementation(Dependencies.appCompat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

package com.orange.ods.app.ui.components.chips

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
Expand All @@ -25,7 +28,6 @@ import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import coil.compose.rememberAsyncImagePainter
import com.google.accompanist.flowlayout.FlowRow
import com.orange.ods.app.R
import com.orange.ods.app.domain.recipes.LocalRecipes
import com.orange.ods.app.ui.components.utilities.ComponentCustomizationBottomSheetScaffold
Expand All @@ -41,7 +43,7 @@ import com.orange.ods.compose.component.chip.OdsFilterChip
import com.orange.ods.compose.component.list.OdsListItem
import com.orange.ods.compose.component.list.OdsSwitchTrailing

@OptIn(ExperimentalMaterialApi::class)
@OptIn(ExperimentalMaterialApi::class, ExperimentalLayoutApi::class)
@Composable
fun ChipFilter() {
val chipCustomizationState = rememberChipCustomizationState(chipType = rememberSaveable { mutableStateOf(ChipCustomizationState.ChipType.Filter) })
Expand Down Expand Up @@ -73,7 +75,10 @@ fun ChipFilter() {
}) {
var selectedChipIndexes by rememberSaveable { mutableStateOf(emptySet<Int>()) }
ChipTypeDemo(chipType = chipType.value) {
FlowRow(modifier = Modifier.fillMaxWidth(), mainAxisSpacing = dimensionResource(id = com.orange.ods.R.dimen.spacing_s)) {
FlowRow(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(dimensionResource(id = com.orange.ods.R.dimen.spacing_s))
) {
recipe.ingredients.forEachIndexed { index, ingredient ->
OdsFilterChip(
text = ingredient.food.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ package com.orange.ods.gradle
object Dependencies {

const val accompanistDrawablePainter = "com.google.accompanist:accompanist-drawablepainter:${Versions.accompanist}"
const val accompanistFlowLayout = "com.google.accompanist:accompanist-flowlayout:${Versions.accompanist}"
const val accompanistPager = "com.google.accompanist:accompanist-pager:${Versions.accompanist}"
const val accompanistPagerIndicators = "com.google.accompanist:accompanist-pager-indicators:${Versions.accompanist}"
const val accompanistSystemUiController = "com.google.accompanist:accompanist-systemuicontroller:${Versions.accompanist}"
const val activityCompose = "androidx.activity:activity-compose:${Versions.activity}"
const val androidGradlePlugin = "com.android.tools.build:gradle:${Versions.androidGradlePlugin}"
Expand Down
1 change: 0 additions & 1 deletion lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ dependencies {
api(project(":theme-contract"))
api(project(":theme-orange"))

implementation(Dependencies.accompanistFlowLayout)
implementation(Dependencies.appCompat)
implementation(platform(Dependencies.composeBom))
api(Dependencies.composeMaterial)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

package com.orange.ods.compose.component.chip

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.selection.selectableGroup
Expand All @@ -23,7 +26,6 @@ import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.semantics.SemanticsPropertyReceiver
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
import com.google.accompanist.flowlayout.FlowRow
import com.orange.ods.R
import com.orange.ods.compose.component.OdsComposable
import com.orange.ods.compose.component.utilities.Preview
Expand All @@ -42,6 +44,7 @@ import com.orange.ods.compose.theme.OdsTheme
* @param modifier Modifier to be applied to the flow row.
* @param chips The list of [OdsChoiceChip]s displayed inside this OdsChoiceChipsFlowRow.
*/
@OptIn(ExperimentalLayoutApi::class)
@Composable
@OdsComposable
fun <T> OdsChoiceChipsFlowRow(
Expand All @@ -56,7 +59,7 @@ fun <T> OdsChoiceChipsFlowRow(
modifier = modifier
.fillMaxWidth()
.selectableGroup(),
mainAxisSpacing = dimensionResource(id = R.dimen.spacing_s),
horizontalArrangement = Arrangement.spacedBy(dimensionResource(id = R.dimen.spacing_s)),
content = {
chips.forEachIndexed { index, odsChoiceChip ->
odsChoiceChip.Content(selected = selectedChipValue == odsChoiceChip.value) { selected ->
Expand Down

0 comments on commit 74b62ac

Please sign in to comment.