Add selectable text to the adventure detail.
This commit is contained in:
parent
4ccf578f45
commit
f43af80f7c
1 changed files with 28 additions and 25 deletions
|
|
@ -14,6 +14,7 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Refresh
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
|
|
@ -206,33 +207,35 @@ private fun AdventureDetailContent(
|
|||
}
|
||||
}
|
||||
)
|
||||
LazyColumn(
|
||||
state = lazyListState,
|
||||
contentPadding = paddingValues,
|
||||
) {
|
||||
itemsIndexed(
|
||||
items = adventures.value,
|
||||
) { index, adventure ->
|
||||
val previous = adventures.value.getOrNull(index - 1)
|
||||
AdventureLine(
|
||||
modifier = when {
|
||||
titleLayoutInfo.value == null && titleIndex.value == index -> {
|
||||
Modifier.onGloballyPositioned { coordinate ->
|
||||
titleLayoutInfo.value = TitleLayoutInfo(
|
||||
position = coordinate.positionInParent().y,
|
||||
height = coordinate.size.height.toFloat(),
|
||||
)
|
||||
SelectionContainer {
|
||||
LazyColumn(
|
||||
state = lazyListState,
|
||||
contentPadding = paddingValues,
|
||||
) {
|
||||
itemsIndexed(
|
||||
items = adventures.value,
|
||||
) { index, adventure ->
|
||||
val previous = adventures.value.getOrNull(index - 1)
|
||||
AdventureLine(
|
||||
modifier = when {
|
||||
titleLayoutInfo.value == null && titleIndex.value == index -> {
|
||||
Modifier.onGloballyPositioned { coordinate ->
|
||||
titleLayoutInfo.value = TitleLayoutInfo(
|
||||
position = coordinate.positionInParent().y,
|
||||
height = coordinate.size.height.toFloat(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> Modifier
|
||||
},
|
||||
paddingValues = rememberPaddingValues(
|
||||
current = adventure,
|
||||
previous = previous,
|
||||
),
|
||||
item = adventure,
|
||||
)
|
||||
else -> Modifier
|
||||
},
|
||||
paddingValues = rememberPaddingValues(
|
||||
current = adventure,
|
||||
previous = previous,
|
||||
),
|
||||
item = adventure,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue