Skip to content

Commit

Permalink
Merge pull request #1 from LDRAlighieri/alighieri/fix/row-and-column-key
Browse files Browse the repository at this point in the history
Update FiberglassRow and FiberglassColumn
  • Loading branch information
LDRAlighieri committed Jan 28, 2023
2 parents f52b9e6 + fc5311f commit 23333de
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 17 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ChangeLog


## Version 0.1.1

* Fix: Row and Column key
* Update: Row and Column are no longer scrollable by default. You need to explicitly set the scroll state.


## Version 0.1.0

* New: Fiberglass module(`composites-fiberglass`):
Expand All @@ -9,5 +16,5 @@
- Fiberglass lazy column Composite with sticky headers
- Fiberglass row Composite
- Fiberglass lazy row Composite
* Update: Kotlin modules dependency to v1.8.0.
* Update: Kotlin to v1.8.0.
* Update: Compose BOM to v2023.01.00.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Add one or more dependencies:

```kotlin
dependencies {
implementation("ru.ldralighieri.composites:composites-fiberglass:0.1.0")
implementation("ru.ldralighieri.composites:composites-fiberglass:0.1.1")
}
```

Expand Down
2 changes: 1 addition & 1 deletion composites-fiberglass/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Add dependency:

```kotlin
dependencies {
implementation("ru.ldralighieri.composites:composites-fiberglass:0.1.0")
implementation("ru.ldralighieri.composites:composites-fiberglass:0.1.1")
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.key
Expand All @@ -38,7 +37,7 @@ import ru.ldralighieri.composites.fiberglass.model.FiberglassItem
* @param items List of [FiberglassItem] items.
* @param itemSlots FiberglassColumn [slots map][FiberglassColumnItemSlots].
* @param modifier The modifier to be applied to the Composite.
* @param state Vertical scroll state.
* @param scrollState Vertical scroll state.
* @param contentPadding A padding around the whole content. Negative padding is not permitted — it
* will cause IllegalArgumentException.
* @param verticalArrangement The vertical arrangement of the layout's children.
Expand All @@ -49,21 +48,21 @@ fun FiberglassColumn(
items: List<FiberglassItem>,
itemSlots: FiberglassColumnItemSlots,
modifier: Modifier = Modifier,
state: ScrollState = rememberScrollState(),
scrollState: ScrollState? = null,
contentPadding: PaddingValues = PaddingValues(0.dp),
verticalArrangement: Arrangement.Vertical = Arrangement.Top,
horizontalAlignment: Alignment.Horizontal = Alignment.Start
) {
Box(modifier = modifier) {
Column(
modifier = Modifier
.verticalScroll(state)
.then(if (scrollState != null) Modifier.verticalScroll(scrollState) else Modifier)
.padding(contentPadding),
verticalArrangement = verticalArrangement,
horizontalAlignment = horizontalAlignment
) {
items.forEach { item ->
key(item) {
key(item.id) {
itemSlots[item::class]?.let { it(item) }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.key
import androidx.compose.ui.Alignment
Expand All @@ -38,7 +37,7 @@ import ru.ldralighieri.composites.fiberglass.model.FiberglassRowItemSlots
* @param items List of [FiberglassItem] items.
* @param itemSlots FiberglassRow [slots map][FiberglassRowItemSlots].
* @param modifier The modifier to be applied to the Composite.
* @param state Horizontal scroll state.
* @param scrollState Horizontal scroll state.
* @param contentPadding A padding around the whole content. Negative padding is not permitted — it
* will cause IllegalArgumentException.
* @param horizontalArrangement The horizontal arrangement of the layout's children.
Expand All @@ -49,21 +48,21 @@ fun FiberglassRow(
items: List<FiberglassItem>,
itemSlots: FiberglassRowItemSlots,
modifier: Modifier = Modifier,
state: ScrollState = rememberScrollState(),
scrollState: ScrollState? = null,
contentPadding: PaddingValues = PaddingValues(0.dp),
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
verticalAlignment: Alignment.Vertical = Alignment.Top
) {
Box(modifier = modifier) {
Row(
modifier = Modifier
.horizontalScroll(state)
.then(if (scrollState != null) Modifier.horizontalScroll(scrollState) else Modifier)
.padding(contentPadding),
horizontalArrangement = horizontalArrangement,
verticalAlignment = verticalAlignment
) {
items.forEach { item ->
key(item) {
key(item.id) {
itemSlots[item::class]?.let { it(item) }
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ systemProp.org.gradle.internal.http.socketTimeout=120000

# Maven
GROUP=ru.ldralighieri.composites
VERSION_NAME=0.2.0-SNAPSHOT
VERSION_NAME=0.1.1

POM_DESCRIPTION=Composites are a group of tools and handy libraries that make it easier to use Jetpack Compose.

Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Plugins
agp = "7.4.0"
dokka = "1.7.20"
spotless = "6.13.0"
spotless = "6.14.0"
mavenPublish = "0.23.2"
gver = "0.44.0"

Expand All @@ -20,15 +20,15 @@ androidxComposeBom = "2023.01.00"
accompanist = "0.28.0"

# Google
googleMaterial="1.7.0"
googleMaterial="1.8.0"

# Lint
ktlint = "0.46.1"


[libraries]
# Androidx
androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "androidxCoreSplashscreen" }
androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "androidxCoreSplashscreen" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidxActivity" }
androidx-paging-compose = { module = "androidx.paging:paging-compose", version.ref = "androidxPagingCompose" }
# Compose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyItemScope
import androidx.compose.foundation.rememberScrollState
import androidx.compose.material.Chip
import androidx.compose.material.ChipDefaults
import androidx.compose.material.ExperimentalMaterialApi
Expand Down Expand Up @@ -133,6 +134,7 @@ fun tagsRowSlot(): FiberglassLazyItemSlot = {
FiberglassRow(
items = tags,
itemSlots = mapOf(TagItem::class to tagSlot()),
scrollState = rememberScrollState(),
contentPadding = PaddingValues(horizontal = AppTheme.dimensions.horizontalGuideline),
horizontalArrangement = Arrangement.spacedBy(12.dp)
)
Expand Down

0 comments on commit 23333de

Please sign in to comment.