Skip to content

Commit

Permalink
use lazy column
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo <[email protected]>
  • Loading branch information
Balcan committed Aug 13, 2024
1 parent 410ea5c commit 7cb74ab
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
Expand Down Expand Up @@ -48,6 +49,7 @@ import androidx.compose.ui.unit.dp
import org.hisp.dhis.mobile.ui.designsystem.component.internal.conditional
import org.hisp.dhis.mobile.ui.designsystem.theme.Radius
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing.Spacing16
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing.Spacing4
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor
Expand Down Expand Up @@ -136,21 +138,23 @@ fun <T> ExpandableItemColumn(
}
}

Column(
LazyColumn (
modifier = modifier
.verticalScroll(rememberScrollState())
.onSizeChanged {
if (parentSize == -1) {
parentSize = it.height
}
},
verticalArrangement = spacedBy(itemSpacing),
contentPadding = PaddingValues(Spacing16)
) {
itemList.forEachIndexed { index, item ->
itemLayout(item, itemVerticalPadding) {
val childMap = childrenSize.toMutableMap()
childMap[index] = it.height
childrenSize = childMap
item{
itemLayout(item, itemVerticalPadding) {
val childMap = childrenSize.toMutableMap()
childMap[index] = it.height
childrenSize = childMap
}
}
}
}
Expand Down

0 comments on commit 7cb74ab

Please sign in to comment.